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

Simply clear cached storage on new version

Open simplenotezy opened this issue 3 years ago • 1 comments

From experience with working with other persistor libraries, when changing version the default behavior is that it will simply wipe whatever is in the localstorage.

I was trying to search around to get this functionality but it seems very difficult. It's not clear exactly how the migrator works from the documentation, but to me it seems to run on every load, no matter if version has changed or not.

Did anybody implement this feature in their own projects, who care to share some code?

simplenotezy avatar Nov 20 '21 19:11 simplenotezy

@simplenotezy I followed https://github.com/rt2zz/redux-persist/blob/master/docs/migrations.md and everything works fine, from: https://github.com/rt2zz/redux-persist/blob/57d1c6ccd37dd8dcfd30f6485e6b35baf5a8f51f/src/createMigrate.ts#L25-L28 (and my exp)

it does not run migrations all the time, just when an "old" version is detected (from a new code)

codingedgar avatar Dec 01 '21 17:12 codingedgar