don't auto-commit an error

This commit is contained in:
echenley 2016-02-09 14:34:48 -06:00
parent 2ae9279171
commit c883e837ba

View File

@ -235,15 +235,18 @@ function liftReducerWith(reducer, initialCommittedState, monitorReducer, options
break; break;
} }
case ActionTypes.PERFORM_ACTION: { case ActionTypes.PERFORM_ACTION: {
if (options.maxAge && stagedActionIds.length === options.maxAge) { if (
options.maxAge &&
stagedActionIds.length === options.maxAge &&
!computedStates[1].error
) {
// If maxAge has been reached, auto-commit earliest non-@@INIT action. // If maxAge has been reached, auto-commit earliest non-@@INIT action.
delete actionsById[stagedActionIds[1]]; delete actionsById[stagedActionIds[1]];
skippedActionIds = skippedActionIds.filter(id => id !== stagedActionIds[1]); skippedActionIds = skippedActionIds.filter(id => id !== stagedActionIds[1]);
stagedActionIds = [0].concat(stagedActionIds.slice(2)); stagedActionIds = [0].concat(stagedActionIds.slice(2));
committedState = computedStates[1].state; committedState = computedStates[1].state;
computedStates = computedStates.slice(1); computedStates = computedStates.slice(1);
} } else if (currentStateIndex === stagedActionIds.length - 1) {
if (currentStateIndex === stagedActionIds.length - 1) {
currentStateIndex++; currentStateIndex++;
} }
const actionId = nextActionId++; const actionId = nextActionId++;