Skip to content
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

documentation: transforms inside persistReducer instead of persistStore #22

Open
FibreFoX opened this issue Jul 23, 2018 · 1 comment
Open

Comments

@FibreFoX
Copy link

FibreFoX commented Jul 23, 2018

Current documentation inside README.md contains the following example code:

persistStore(store, {
  transforms: [
    saveSubsetFilter,
    saveSubsetBlacklistFilter,
    loadSubsetFilter,
    saveAndloadSubsetFilter,
  ]
});

Using this with redux-persist in version 5.9.1 results in thrown error-message:
redux-persist: invalid option passed to persistStore: "transforms". You may be incorrectly passing persistConfig into persistStore, whereas it should be passed into persistReducer.

Please update usage-example to something like this:

// "loading"-attribute should not be loaded from store
const loadPartialLoginFilter = createFilter(
    'login',
    null,
    ['loading'],
    'blacklist'
);

// prepare persist configuration
const persistConfig = {
    key: 'root',
    storage,
    whitelist: ['settings', 'login'],
    transforms: [
        loadPartialLoginFilter
    ]
};
  
const persistedReducer = persistReducer(persistConfig, reducers);

const store = createStore(
    persistedReducer,
    {},
    composeEnhancers(applyMiddleware(ReduxThunk, createLogicMiddleware(logics, deps)))
);

// "transforms" is not applied here
export const persistor = persistStore(store);
@ifeoluwak
Copy link

This issue still hasn't been fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants