start new chain of actions if an action is lifted when the currentStateIndex isn't at the most recent state

This commit is contained in:
Cale Newman 2015-08-04 22:57:52 -05:00
parent 9e9d23daf3
commit 3e4eaab207

View File

@ -135,8 +135,12 @@ function liftReducer(reducer, initialState) {
case ActionTypes.PERFORM_ACTION:
if (currentStateIndex === stagedActions.length - 1) {
currentStateIndex++;
stagedActions = [...stagedActions, liftedAction.action];
} else {
stagedActions = stagedActions.slice(0, currentStateIndex + 1).concat(liftedAction.action);
currentStateIndex = stagedActions.length - 1;
skippedActions = {};
}
stagedActions = [...stagedActions, liftedAction.action];
break;
case ActionTypes.SET_MONITOR_STATE:
monitorState = liftedAction.monitorState;