Closed BATMAH69 closed 7 years ago
Do you mean you import a state from a state.json
file? Are you using redux-devtools-extension? If yes, give serialize.immutable
option a try.
If you are only using pure redux-devtools, then you are only making your workflow more difficult than it needs to be. In that case you'll have to use its store enhancer like this. Also, I think, you'll have to serialize/deserialize Immutable collections yourself.
Also it seems to me you're trying to use your fixer
function as a store enhancer to wrap state on each dispatch. You probably meant to employ a middleware here with applyMiddleware.
Actually, you won't need to go as far as resorting to middleware -- it is much more reasonable to just always work with Immutable data inside your reducers/initialState.
Thank you for the detailed answer. Yes, it was about redux-devtools-extension in this case and serialize.immutable option solve my problem.
It might be useful to add a link to answer in warning message, to simplify the search.
Add error text for search engine: The previous state received by the reducer is of unexpected type. Expected argument to be an instance of Immutable.Iterable with the following properties inputState.withMutations is not a function
Thank you @Velenir.
In my case, initialState in createStore is still is Object const store = createStore( reducer, Immutable.Map({}), // THIS WOULD FIX MY PROBLEM applyMiddleware(thunk, logger) );
When I try import state from file via redux-devtool - error happen.
inputState.withMutations((temporaryState)...
^^^^^^^^^^ - Object
https://github.com/gajus/redux-immutable/blob/master/src/combineReducers.js#L22 It might be useful to add a third argument in combineReducers.For example in my case: file
const fixer = state => Immutable.fromJS(state); // if state already immutable it do nothing
const store = createStore(rootReducer, initialState, fixer);
libfixer(inputState).withMutations((temporaryState)...
Sorry for my English.