Upgrading to 1.0
Imports
CommonJS and UMD bundles now need a .default
added to your imports.
ES6 imports should work as expected.
distinctState()
filter applied by default
distinctState()
filter applied by defaultIn 1.0 and greater, state is only added to history if it is different than the previous state (checked by object reference equality ===
). The distinctState()
filter is now deprecated and removed as there is no need for it.
History API change in versions < 0.4
< 0.4
In versions 0.3 and earlier, the history state was stored in the form.
In versions 0.4
and greater, the full history is exposed directly.
InitialState
Before 1.0
, you would pass an initialState
or initialHistory
as a config option.
Now, these options are removed in favor of Redux's preloadedState
parameter.
When providing initial state, redux-undo will automatically detect whether or not it is a complete history (with past
, present
, future
) or not. If it is not, it will automatically convert it to one.
If you wish to provide an initial history, e.g. you want to prefill past
to recover a previous session, you must provide all three fields for redux-undo to recognize it as a history object.
For information about initialState
with typescript, look here.
0.X behaviour for pushing filtered state into history, and the syncFilter option
When dealing with filtered state, the old behaviour was to keep track of the "trailing" state (state 4 in this example).
However, states 3 and 4 were the result of filtered actions and should probably not be added to history. Instead, state 2 should be the last state pushed into history. Using _latestUnfiltered
, this is now the default in 1.X
If you still need to old behaviour, use the syncFilter option.
Last updated
Was this helpful?