Remove RECOMPUTE_STATES

This commit is contained in:
Dan Abramov 2015-09-27 16:55:57 +03:00
parent ddeda5d4d6
commit 58c0a6432f
2 changed files with 1 additions and 35 deletions

View File

@ -5,8 +5,7 @@ const ActionTypes = {
COMMIT: 'COMMIT',
SWEEP: 'SWEEP',
TOGGLE_ACTION: 'TOGGLE_ACTION',
JUMP_TO_STATE: 'JUMP_TO_STATE',
RECOMPUTE_STATES: 'RECOMPUTE_STATES'
JUMP_TO_STATE: 'JUMP_TO_STATE'
};
const INIT_ACTION = {
@ -142,13 +141,6 @@ function liftReducer(reducer, monitorReducer, initialState) {
stagedActions = [...stagedActions, liftedAction.action];
timestamps = [...timestamps, liftedAction.timestamp];
break;
case ActionTypes.RECOMPUTE_STATES:
stagedActions = liftedAction.stagedActions;
timestamps = liftedAction.timestamps;
committedState = liftedAction.committedState;
currentStateIndex = stagedActions.length - 1;
skippedActions = {};
break;
default:
break;
}
@ -241,13 +233,6 @@ export const ActionCreators = {
},
jumpToState(index) {
return { type: ActionTypes.JUMP_TO_STATE, index };
},
recomputeStates(committedState, stagedActions) {
return {
type: ActionTypes.RECOMPUTE_STATES,
committedState,
stagedActions
};
}
};

View File

@ -143,25 +143,6 @@ describe('devTools', () => {
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', () => {
store.dispatch({ type: 'INCREMENT' });
store.dispatch({ type: 'DECREMENT' });