mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-02-07 15:10:45 +03:00
Remove RECOMPUTE_STATES
This commit is contained in:
parent
ddeda5d4d6
commit
58c0a6432f
|
@ -5,8 +5,7 @@ const ActionTypes = {
|
||||||
COMMIT: 'COMMIT',
|
COMMIT: 'COMMIT',
|
||||||
SWEEP: 'SWEEP',
|
SWEEP: 'SWEEP',
|
||||||
TOGGLE_ACTION: 'TOGGLE_ACTION',
|
TOGGLE_ACTION: 'TOGGLE_ACTION',
|
||||||
JUMP_TO_STATE: 'JUMP_TO_STATE',
|
JUMP_TO_STATE: 'JUMP_TO_STATE'
|
||||||
RECOMPUTE_STATES: 'RECOMPUTE_STATES'
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const INIT_ACTION = {
|
const INIT_ACTION = {
|
||||||
|
@ -142,13 +141,6 @@ function liftReducer(reducer, monitorReducer, initialState) {
|
||||||
stagedActions = [...stagedActions, liftedAction.action];
|
stagedActions = [...stagedActions, liftedAction.action];
|
||||||
timestamps = [...timestamps, liftedAction.timestamp];
|
timestamps = [...timestamps, liftedAction.timestamp];
|
||||||
break;
|
break;
|
||||||
case ActionTypes.RECOMPUTE_STATES:
|
|
||||||
stagedActions = liftedAction.stagedActions;
|
|
||||||
timestamps = liftedAction.timestamps;
|
|
||||||
committedState = liftedAction.committedState;
|
|
||||||
currentStateIndex = stagedActions.length - 1;
|
|
||||||
skippedActions = {};
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -241,13 +233,6 @@ export const ActionCreators = {
|
||||||
},
|
},
|
||||||
jumpToState(index) {
|
jumpToState(index) {
|
||||||
return { type: ActionTypes.JUMP_TO_STATE, index };
|
return { type: ActionTypes.JUMP_TO_STATE, index };
|
||||||
},
|
|
||||||
recomputeStates(committedState, stagedActions) {
|
|
||||||
return {
|
|
||||||
type: ActionTypes.RECOMPUTE_STATES,
|
|
||||||
committedState,
|
|
||||||
stagedActions
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -143,25 +143,6 @@ describe('devTools', () => {
|
||||||
expect(store.getState()).toBe(2);
|
expect(store.getState()).toBe(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should recompute', () => {
|
|
||||||
store.dispatch({ type: 'INCREMENT' });
|
|
||||||
store.dispatch({ type: 'DECREMENT' });
|
|
||||||
store.dispatch({ type: 'INCREMENT' });
|
|
||||||
expect(store.getState()).toBe(1);
|
|
||||||
|
|
||||||
let stagedActions = [...store.devToolsStore.getState().stagedActions];
|
|
||||||
// replace DECREMENT with INCREMENT (stagedAction[0] is @@INIT)
|
|
||||||
stagedActions[2] = { type: 'INCREMENT' };
|
|
||||||
const committedState = 10;
|
|
||||||
|
|
||||||
devToolsStore.dispatch(ActionCreators.recomputeStates(
|
|
||||||
committedState,
|
|
||||||
stagedActions
|
|
||||||
));
|
|
||||||
|
|
||||||
expect(store.getState()).toBe(13);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should replace the reducer', () => {
|
it('should replace the reducer', () => {
|
||||||
store.dispatch({ type: 'INCREMENT' });
|
store.dispatch({ type: 'INCREMENT' });
|
||||||
store.dispatch({ type: 'DECREMENT' });
|
store.dispatch({ type: 'DECREMENT' });
|
||||||
|
|
Loading…
Reference in New Issue
Block a user