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

Doesn't seem to work #17

Open
trybick opened this issue Jun 12, 2020 · 2 comments
Open

Doesn't seem to work #17

trybick opened this issue Jun 12, 2020 · 2 comments

Comments

@trybick
Copy link

trybick commented Jun 12, 2020

Can you spot something I'm doing wrong? I have two reducers and am adding expireReducer to the rootConfig.

const userPersistConfig = {
  key: 'user',
  storage,
  blacklist: ['hasLocalWarningToastBeenShown'],
};

const tvPersistConfig = {
  key: 'tv',
  storage,
};

const rootPersistConfig = {
  key: 'root',
  storage,
  blacklist: ['user'],
  transforms: [
    expireReducer('tv', {   // expire here!
      expireSeconds: 10,
      autoExpire: true,
    }),
  ],
};

const rootReducer = combineReducers({
  user: persistReducer(userPersistConfig, userReducer),
  tv: persistReducer(tvPersistConfig, tvReducer),
});

const persistedReducer = persistReducer(rootPersistConfig, rootReducer);
@mathe-matician
Copy link

@trybick I was having a similar problem. It might be worth noting that I thought that seconds might actually be milliseconds, so I tried 10000, and it still did not work. I ended up using redux-persist-transform-expire-in, which worked perfectly in my case (and note that it uses milliseconds if you use it).

@appkery
Copy link

appkery commented May 16, 2023

It works very well. See #33.
You should have used a key inside of root.

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

No branches or pull requests

3 participants