How to force reset after OTA update of local storage containing redux-persist (IOS and Android)

Hi there,

Issue:
I am using redux to keep some user settings locally and redux-persist to save them to AsyncStorage. This works fine. However there is an issue when publishing new app updates in the particular case the object structure of the redux store has been modified. When triggering the OTA update, the redux objects are not reset with the new structure (logically because of the persist). Being the only “manual” solution to delete the previous version of the app first and install the new one.

solution desired
When launching the app, I am checking for new OTA updates (with expo Updates.checkForUpdateAsync) and forcing a restart of the app. My idea is force a full reset of the local storage in case the new release has a modified redux-store. This could be signalled/checked by for example a specific increase in version number (v1.1.1 => v1.1.2 no reset needed, v1.1.1 => v1.2.0 reset required).

Thanks for your inputs !

I think I have found in which direction to look: Hot Module Replacement and Persist

Any feedback still welcome !

Use migrations

Hi Sepu, indeed “migrations” … although it took me a while to find any documentation on the topic. But luckily finally here is the perfect post by Lusan Dias.

How to use Redux Persist when migrating your states

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.