How to clear localStorage data of Expo app from Android?

#1

Hey guys,

I’ve used redux-persist on an app I’m building with Expo. I ran into an issue, and I’m kinda stuck because everytime I reload the app, the “wrong” data is loaded from my localStorage. How do I clear this local data for this app only?

I’m thinking to go Apps > Expo > Clear Cache. But won’t this clear localStorage data of my other (Expo) apps too?

#2

Hey, just to answer my own question (and also to clarify), this is not an Expo related issue at all.

I was able to fix my ‘issue’ by preventing redux-persist code to run on my app. I removed all persistStore and code wherever I had used it to ensure redux-persist does not initialise when I re-load the app.

Once I was able to solve my issue, I re-enabled my redux-persist code once again.

Hope this helps anybody else stuck in a similar situation.

Quick update: To add to my answer, I eventually also had to purge my persistor object (see docs here in redux-persist) to clear all my saved state in local, ie, persistStore(store).purge(). Incredibly, this also fixed the lag I was getting while transitioning between screens on my TabNavigator/ StackNavigator.

1 Like
#3

Thanks for posting the update!

#4

Sure thing, @adamjnav :slight_smile:

closed #5

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