Skip to content

Commit 10debcc

Browse files
brandonrobertsMikeRyanDev
authored andcommitted
fix(StoreDevtools): Recompute state history when reducers are updated (#844)
This fixes the issue with time-traveling to previous states before the reducers were updated. Each state history item will be recomputed with the latest reducer.
1 parent 2e4bea2 commit 10debcc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

modules/store-devtools/src/reducer.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,12 @@ export function liftReducerWith(
413413
options.stateSanitizer
414414
);
415415

416+
// Recompute state history with latest reducer and update action
417+
computedStates = computedStates.map(cmp => ({
418+
...cmp,
419+
state: reducer(cmp.state, liftedAction),
420+
}));
421+
416422
currentStateIndex = minInvalidatedStateIndex;
417423

418424
if (options.maxAge && stagedActionIds.length > options.maxAge) {

0 commit comments

Comments
 (0)