kamranahmedse / redux-persist-expire

Expiring transformer for redux-persist
MIT License
78 stars 12 forks source link

Support `expiredState: undefined` #34

Open VinceBT-BG opened 1 year ago

VinceBT-BG commented 1 year ago

The initial state of the key in my reducer is undefined but after expiration it gets reset to {} which is truthy so it breaks my app, would it be possible to pass undefined or state that the element should be cleared ?

PS: You have examples using expiredState: [] but you are using Object.assign({}, config.expiredState) so anything other than an object will always return empty object, see screenshot:

Capture d’écran 2023-02-24 à 17 16 19

PS2: Why not make expiredState a function that returns a state, so it is possible to return undefined, while still being able to just not pass the function to not have a state reset