Skip to content

Commit b4c4bd8

Browse files
xerebzAlain Leon
authored and
Alain Leon
committed
Fix action missing bug when playback speed is set to live
1 parent 61c09e1 commit b4c4bd8

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

Diff for: packages/redux-devtools-slider-monitor/src/SliderMonitor.tsx

+14-17
Original file line numberDiff line numberDiff line change
@@ -198,28 +198,25 @@ class SliderMonitor<S, A extends Action<string>> extends (PureComponent ||
198198
const aLoop = () => {
199199
const replayDiff = Date.now() - currentTimestamp;
200200
if (replayDiff >= timestampDiff) {
201-
this.props.dispatch(
202-
jumpToAction(
203-
this.props.stagedActionIds[this.props.currentStateIndex + 1],
204-
),
205-
);
206-
207-
if (
208-
this.props.currentStateIndex >=
209-
this.props.computedStates.length - 1
210-
) {
201+
if (this.props.currentStateIndex >= this.props.computedStates.length - 1) {
211202
this.pauseReplay();
212203
return;
213204
}
214205

215-
timestampDiff = this.getLatestTimestampDiff(
216-
this.props.currentStateIndex,
217-
);
218-
currentTimestamp = Date.now();
206+
// Update to check for nextActionId and dispatch it
207+
const nextActionId = this.props.stagedActionIds[this.props.currentStateIndex + 1];
208+
if (nextActionId !== undefined) {
209+
this.props.dispatch(jumpToAction(nextActionId));
219210

220-
this.setState({
221-
timer: requestAnimationFrame(aLoop),
222-
});
211+
timestampDiff = this.getLatestTimestampDiff(this.props.currentStateIndex);
212+
currentTimestamp = Date.now();
213+
214+
this.setState({
215+
timer: requestAnimationFrame(aLoop),
216+
});
217+
} else {
218+
this.pauseReplay();
219+
}
223220
} else {
224221
this.setState({
225222
timer: requestAnimationFrame(aLoop),

0 commit comments

Comments
 (0)