mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-23 14:39:58 +03:00
Use jumpToAction instead of jumpToState
This commit is contained in:
parent
3930411ade
commit
ec05f649b1
|
@ -17,7 +17,7 @@ import reducer from './reducers';
|
||||||
import SliderButton from './SliderButton';
|
import SliderButton from './SliderButton';
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/unbound-method
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
||||||
const { reset, jumpToState } = ActionCreators;
|
const { reset, jumpToAction } = ActionCreators;
|
||||||
|
|
||||||
interface ExternalProps<S, A extends Action<unknown>> {
|
interface ExternalProps<S, A extends Action<unknown>> {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||||
|
@ -151,11 +151,12 @@ class SliderMonitor<S, A extends Action<unknown>> extends (PureComponent ||
|
||||||
this.pauseReplay();
|
this.pauseReplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.props.dispatch(jumpToState(value));
|
this.props.dispatch(jumpToAction(this.props.stagedActionIds[value]));
|
||||||
};
|
};
|
||||||
|
|
||||||
startReplay = () => {
|
startReplay = () => {
|
||||||
const { computedStates, currentStateIndex, dispatch } = this.props;
|
const { computedStates, currentStateIndex, dispatch, stagedActionIds } =
|
||||||
|
this.props;
|
||||||
|
|
||||||
if (computedStates.length < 2) {
|
if (computedStates.length < 2) {
|
||||||
return;
|
return;
|
||||||
|
@ -164,20 +165,20 @@ class SliderMonitor<S, A extends Action<unknown>> extends (PureComponent ||
|
||||||
|
|
||||||
let stateIndex;
|
let stateIndex;
|
||||||
if (currentStateIndex === computedStates.length - 1) {
|
if (currentStateIndex === computedStates.length - 1) {
|
||||||
dispatch(jumpToState(0));
|
dispatch(jumpToAction(stagedActionIds[0]));
|
||||||
stateIndex = 0;
|
stateIndex = 0;
|
||||||
} else if (currentStateIndex === computedStates.length - 2) {
|
} else if (currentStateIndex === computedStates.length - 2) {
|
||||||
dispatch(jumpToState(currentStateIndex + 1));
|
dispatch(jumpToAction(stagedActionIds[currentStateIndex + 1]));
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
stateIndex = currentStateIndex + 1;
|
stateIndex = currentStateIndex + 1;
|
||||||
dispatch(jumpToState(currentStateIndex + 1));
|
dispatch(jumpToAction(stagedActionIds[currentStateIndex + 1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
let counter = stateIndex;
|
let counter = stateIndex;
|
||||||
const timer = window.setInterval(() => {
|
const timer = window.setInterval(() => {
|
||||||
if (counter + 1 <= computedStates.length - 1) {
|
if (counter + 1 <= computedStates.length - 1) {
|
||||||
dispatch(jumpToState(counter + 1));
|
dispatch(jumpToAction(stagedActionIds[counter + 1]));
|
||||||
}
|
}
|
||||||
counter += 1;
|
counter += 1;
|
||||||
|
|
||||||
|
@ -198,7 +199,7 @@ class SliderMonitor<S, A extends Action<unknown>> extends (PureComponent ||
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.props.currentStateIndex === this.props.computedStates.length - 1) {
|
if (this.props.currentStateIndex === this.props.computedStates.length - 1) {
|
||||||
this.props.dispatch(jumpToState(0));
|
this.props.dispatch(jumpToAction(this.props.stagedActionIds[0]));
|
||||||
|
|
||||||
this.loop(0);
|
this.loop(0);
|
||||||
} else {
|
} else {
|
||||||
|
@ -213,7 +214,11 @@ class SliderMonitor<S, A extends Action<unknown>> extends (PureComponent ||
|
||||||
const aLoop = () => {
|
const aLoop = () => {
|
||||||
const replayDiff = Date.now() - currentTimestamp;
|
const replayDiff = Date.now() - currentTimestamp;
|
||||||
if (replayDiff >= timestampDiff) {
|
if (replayDiff >= timestampDiff) {
|
||||||
this.props.dispatch(jumpToState(this.props.currentStateIndex + 1));
|
this.props.dispatch(
|
||||||
|
jumpToAction(
|
||||||
|
this.props.stagedActionIds[this.props.currentStateIndex + 1]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.props.currentStateIndex >=
|
this.props.currentStateIndex >=
|
||||||
|
@ -275,7 +280,11 @@ class SliderMonitor<S, A extends Action<unknown>> extends (PureComponent ||
|
||||||
this.pauseReplay();
|
this.pauseReplay();
|
||||||
|
|
||||||
if (this.props.currentStateIndex !== 0) {
|
if (this.props.currentStateIndex !== 0) {
|
||||||
this.props.dispatch(jumpToState(this.props.currentStateIndex - 1));
|
this.props.dispatch(
|
||||||
|
jumpToAction(
|
||||||
|
this.props.stagedActionIds[this.props.currentStateIndex - 1]
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -283,7 +292,11 @@ class SliderMonitor<S, A extends Action<unknown>> extends (PureComponent ||
|
||||||
this.pauseReplay();
|
this.pauseReplay();
|
||||||
|
|
||||||
if (this.props.currentStateIndex !== this.props.computedStates.length - 1) {
|
if (this.props.currentStateIndex !== this.props.computedStates.length - 1) {
|
||||||
this.props.dispatch(jumpToState(this.props.currentStateIndex + 1));
|
this.props.dispatch(
|
||||||
|
jumpToAction(
|
||||||
|
this.props.stagedActionIds[this.props.currentStateIndex + 1]
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user