Skip to content

Fix action missing bug when playback speed is set to live #1752

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions packages/redux-devtools-slider-monitor/src/SliderMonitor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -212,14 +206,23 @@ class SliderMonitor<S, A extends Action<string>> extends (PureComponent ||
return;
}

timestampDiff = this.getLatestTimestampDiff(
this.props.currentStateIndex,
);
currentTimestamp = Date.now();
// 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));

this.setState({
timer: requestAnimationFrame(aLoop),
});
timestampDiff = this.getLatestTimestampDiff(
this.props.currentStateIndex,
);
currentTimestamp = Date.now();

this.setState({
timer: requestAnimationFrame(aLoop),
});
} else {
this.pauseReplay();
}
} else {
this.setState({
timer: requestAnimationFrame(aLoop),
Expand Down
Loading