Redux-persist: Can't get the store to persist on Android, but it works fine on iOS

Created on 19 May 2016  路  5Comments  路  Source: rt2zz/redux-persist

This issue doesn't make sense to me because everything works fine on iOS, but then when I try it on Android my store fails to persist. Is there any option I have to set on AsyncStorage for Android?
Using React Native 0.24 and the latest version of redux-persist.

const store = createStore(
  reducers,
  applyMiddleware(thunk),
  autoRehydrate()
);

persistStore(store, { storage: AsyncStorage });

export const App = () => (
  <Provider store={store}>
    <MyApp />
  </Provider>
);

Most helpful comment

@sscaff1 For some reason this kept happening to me on Android too, usually whenever I upgraded React-Native. The solution was usually to nuke node_modules, so hopefully that works for you too!
rm -rf node_modules/ && npm install

All 5 comments

@sscaff1 For some reason this kept happening to me on Android too, usually whenever I upgraded React-Native. The solution was usually to nuke node_modules, so hopefully that works for you too!
rm -rf node_modules/ && npm install

works thanks!

gah! npm!

Let me know if there is anything we can do to avoid this but from what it sounds like this is more npm bugs.

@rt2zz Yea :/ a ton of random stuff has been breaking when upgrading react version, although I will say that sadly redux persist seems to be the only library that fails silently for me :(

BTW thanks for making this great library, it's definitely helped me a ton!

We could do some sanity checks in dev, e.g. on first storage, immediately get the stored key and verify the data is correct...

Was this page helpful?
0 / 5 - 0 ratings