Skip to content

Commit 4a73935

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

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

packages/redux-devtools-slider-monitor/src/SliderMonitor.tsx

+16-13
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,6 @@ 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-
207201
if (
208202
this.props.currentStateIndex >=
209203
this.props.computedStates.length - 1
@@ -212,14 +206,23 @@ class SliderMonitor<S, A extends Action<string>> extends (PureComponent ||
212206
return;
213207
}
214208

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

220-
this.setState({
221-
timer: requestAnimationFrame(aLoop),
222-
});
215+
timestampDiff = this.getLatestTimestampDiff(
216+
this.props.currentStateIndex,
217+
);
218+
currentTimestamp = Date.now();
219+
220+
this.setState({
221+
timer: requestAnimationFrame(aLoop),
222+
});
223+
} else {
224+
this.pauseReplay();
225+
}
223226
} else {
224227
this.setState({
225228
timer: requestAnimationFrame(aLoop),

0 commit comments

Comments
 (0)