kilkelly / redux-localstorage-simple

Save and load Redux state to and from LocalStorage.
MIT License
131 stars 23 forks source link

Could clear also have a debounce? #15

Open ridem opened 6 years ago

ridem commented 6 years ago

Not very important as the clear action can be debounced easily by the user, but for the sake of completion, could clear also have a debounce option? If save is debounced, then clearing at a certain point in state history is overriden with the debounced save.

kilkelly commented 6 years ago

It seems like this would be a very rare edge case. Have you personally come across this in your projects? I'll add it if it is causing problems but for the sake of keeping the library lean I'd rather not if it is such a rare case.

ridem commented 6 years ago

Yes I have, but I could easily make the debounce myself. Let's say I want to call clear whenever a user logs out. The action of logging out triggers some actions and is potentially changing the state tree, which seems just fair. If clear isn't debounced and save is, then what happened was that data would come back in localstorage right after the clear action.