-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deal with nested combineReducers #4
Comments
+1 for this one, any idea or solution? |
@EQuimper is this how your store looks like? then the save filter should look like this:
otherwise if its only a subset from the store, then you could try this instead:
see https://github.com/edy/redux-persist-transform-filter/blob/master/spec.js#L43-L50 |
@edy Here is my store: {
route: {
locationBeforeTransitions: null
},
language: {
locale: 'en'
},
home: {
introductionVisible: false
}
} The following code works fine: const persistReducer = createFilter(
null,
['home.introductionVisible']
); And this one doesn't: const persistReducer = createFilter(
'home',
['introductionVisible']
); According to your previous message, both should work. Any ideas? |
Hm, this snippet: const persistReducer = createFilter(
null,
['home.introductionVisible']
); Doesn't seem to work either. It persists the whole May this be caused by the fact I'm using |
@yantakus i had similar issue and like as you say this is an issue regarding immutable that is not supported by this component, so i ended up doing my own filter: let whitelistMyTopLevelReducerTransform = createTransform(
(inboundState, key) => {
if (key !== 'myTopLevelReducer')
return inboundState
else
return { persistProperty: inboundState.persistProperty }
}
) also take in count you need to resolve your immutables import {persistStore, autoRehydrate, createTransform} from 'redux-persist'
import immutableTransform from 'redux-persist-transform-immutable'
persistStore(store, {storage: AsyncStorage, transforms: [whitelistMyTopLevelReducerTransform, immutableTransform()]}) if one day there is a solution for nested reducers with inmmutables i will come back to this component :) |
Here's my solution for this: rt2zz/redux-persist#330 (comment) |
@yantakus @kanekotic https://github.com/actra-development/redux-persist-transform-filter-immutable ;-) |
How can I deal with nestedReducer if I have something like
But I want to deal only with
ui.gamesLiked
andui.channelsLiked
The text was updated successfully, but these errors were encountered: