From c883e837ba70c17df4ecfc9975afa998ed29179f Mon Sep 17 00:00:00 2001 From: echenley Date: Tue, 9 Feb 2016 14:34:48 -0600 Subject: [PATCH] don't auto-commit an error --- src/instrument.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/instrument.js b/src/instrument.js index 4c5f719f..664f81b9 100644 --- a/src/instrument.js +++ b/src/instrument.js @@ -235,15 +235,18 @@ function liftReducerWith(reducer, initialCommittedState, monitorReducer, options break; } 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. delete actionsById[stagedActionIds[1]]; skippedActionIds = skippedActionIds.filter(id => id !== stagedActionIds[1]); stagedActionIds = [0].concat(stagedActionIds.slice(2)); committedState = computedStates[1].state; computedStates = computedStates.slice(1); - } - if (currentStateIndex === stagedActionIds.length - 1) { + } else if (currentStateIndex === stagedActionIds.length - 1) { currentStateIndex++; } const actionId = nextActionId++;