top level immutable support pls.
is there any plan to support top level immutable ?
+1 :(
+1
+1
I think the relevant snipped is this:
var _ref = state || {},
_persist = _ref._persist,
rest = _objectWithoutProperties(_ref, ['_persist']);
var restState = rest;
if (action.type === PERSIST) {
...
getStoredState(config).then(function (restoredState) {
...
}, function (err) {
...
});
return _extends({}, baseReducer(restState, action), {
});
}
It's when baseReducer(restState, action) is called we see this Uncaught TypeError: n.withMutations is not a function. There's no way to fix it using transforms because transforms are called from getStoredState and it isn't called to get restState. For some reason _objectWithoutProperties is used so it's POJO and doesn't have any methods. That's probably why we see this note:
if your top level state is an immutable map, this module will not work.
So how to fix it? Let's read v5 migration guide: https://github.com/rt2zz/redux-persist/blob/master/docs/MigrationGuide-v5.md
state methods can no longer be overridden which means all top level state needs to be plain objects. redux-persist-transform-immutable will continue to operate as before as it works on substate, not top level state.
And here's the issue describing various workarounds: https://github.com/rt2zz/redux-persist-immutable/issues/33
Well, that's bad I suppose.
I hope we are talking about the same: for top-level-immutable supporting. Feel free to comment, find bugs, and ask questions.
+1