Fix action missing bug when playback speed is set to live

This commit is contained in:
Alain Leon 2024-09-04 21:50:21 -07:00 committed by Alain Leon
parent 61c09e1cc3
commit 4a739356b1

View File

@ -198,12 +198,6 @@ class SliderMonitor<S, A extends Action<string>> extends (PureComponent ||
const aLoop = () => {
const replayDiff = Date.now() - currentTimestamp;
if (replayDiff >= timestampDiff) {
this.props.dispatch(
jumpToAction(
this.props.stagedActionIds[this.props.currentStateIndex + 1],
),
);
if (
this.props.currentStateIndex >=
this.props.computedStates.length - 1
@ -212,6 +206,12 @@ class SliderMonitor<S, A extends Action<string>> extends (PureComponent ||
return;
}
// Update to check for nextActionId and dispatch it
const nextActionId =
this.props.stagedActionIds[this.props.currentStateIndex + 1];
if (nextActionId !== undefined) {
this.props.dispatch(jumpToAction(nextActionId));
timestampDiff = this.getLatestTimestampDiff(
this.props.currentStateIndex,
);
@ -220,6 +220,9 @@ class SliderMonitor<S, A extends Action<string>> extends (PureComponent ||
this.setState({
timer: requestAnimationFrame(aLoop),
});
} else {
this.pauseReplay();
}
} else {
this.setState({
timer: requestAnimationFrame(aLoop),