Skip to content

Commit

Permalink
fix(StoreDevtools): Recompute state history when reducers are updated (
Browse files Browse the repository at this point in the history
…#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.
  • Loading branch information
brandonroberts authored and MikeRyanDev committed Feb 20, 2018
1 parent 2e4bea2 commit 10debcc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions modules/store-devtools/src/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,12 @@ export function liftReducerWith(
options.stateSanitizer
);

// Recompute state history with latest reducer and update action
computedStates = computedStates.map(cmp => ({
...cmp,
state: reducer(cmp.state, liftedAction),
}));

currentStateIndex = minInvalidatedStateIndex;

if (options.maxAge && stagedActionIds.length > options.maxAge) {
Expand Down

0 comments on commit 10debcc

Please sign in to comment.