redux-persist-transform-filter icon indicating copy to clipboard operation
redux-persist-transform-filter copied to clipboard

documentation: transforms inside persistReducer instead of persistStore

Open FibreFoX opened this issue 7 years ago • 1 comments

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);

FibreFoX avatar Jul 23 '18 10:07 FibreFoX

This issue still hasn't been fixed

ifeoluwak avatar Sep 19 '18 12:09 ifeoluwak