You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i was in the middle of another pr when i found this - i'm not sure the best way forward.
it looks like there are two places to set keyPrefix, in the new CookieStorage() instantiation or as part of the options passed to createPersistor from redux-persist.
if i set keyPrefix in createPersistor then i can't get the custom expiration logic here to work correctly.
consider a reducer foo - if keyPrefix='_' in createPersistor then the CookieStorage's (get|set|remove)Item methods will all be called with _foo as the key instead of foo.
if i set keyPrefix in the CookieStorage (and not in createPersistor) things still don't work correctly because redux-persit will set a default prefix of reduxPersist: which still breaks this logic.
The text was updated successfully, but these errors were encountered:
CookieStorage doesn't know about the prefix used by redux-persist. As you say, (get|set|remove)Item) methods get called with the prefix.
Therefore, if you'd like to use custom expiration for individual keys, you need to include the redux-persist provided prefix in the configuration. For instance, using default reduxPersist: prefix:
new CookieStorage({
expiration: {
default: null,
"reduxPersist:foo": 600
}
})
Could you try and see if this works for you? If so, I will update the example in the README to explain this properly.
i was in the middle of another pr when i found this - i'm not sure the best way forward.
it looks like there are two places to set
keyPrefix
, in thenew CookieStorage()
instantiation or as part of the options passed tocreatePersistor
fromredux-persist
.if i set
keyPrefix
increatePersistor
then i can't get the custom expiration logic here to work correctly.consider a reducer
foo
- ifkeyPrefix='_'
increatePersistor
then theCookieStorage
's(get|set|remove)Item
methods will all be called with_foo
as the key instead offoo
.if i set
keyPrefix
in theCookieStorage
(and not increatePersistor
) things still don't work correctly becauseredux-persit
will set a default prefix of reduxPersist: which still breaks this logic.The text was updated successfully, but these errors were encountered: