Skip to content

Commit c883e83

Browse files
committed
don't auto-commit an error
1 parent 2ae9279 commit c883e83

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/instrument.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,18 @@ function liftReducerWith(reducer, initialCommittedState, monitorReducer, options
235235
break;
236236
}
237237
case ActionTypes.PERFORM_ACTION: {
238-
if (options.maxAge && stagedActionIds.length === options.maxAge) {
238+
if (
239+
options.maxAge &&
240+
stagedActionIds.length === options.maxAge &&
241+
!computedStates[1].error
242+
) {
239243
// If maxAge has been reached, auto-commit earliest non-@@INIT action.
240244
delete actionsById[stagedActionIds[1]];
241245
skippedActionIds = skippedActionIds.filter(id => id !== stagedActionIds[1]);
242246
stagedActionIds = [0].concat(stagedActionIds.slice(2));
243247
committedState = computedStates[1].state;
244248
computedStates = computedStates.slice(1);
245-
}
246-
if (currentStateIndex === stagedActionIds.length - 1) {
249+
} else if (currentStateIndex === stagedActionIds.length - 1) {
247250
currentStateIndex++;
248251
}
249252
const actionId = nextActionId++;

0 commit comments

Comments
 (0)