rt2zz / redux-persist

persist and rehydrate a redux store
MIT License
12.91k stars 862 forks source link

persistReducer only works for very small sized data #1411

Open prieyudaarvis opened 1 year ago

prieyudaarvis commented 1 year ago

I have an app that use persistReducer(). At first it doesnt work, realize the response from webservice that I want to keep it offline is huge (4.6MB). Then I optimize it, now its around 6-15KB.

But the data get bigger, around 1.6MB (4000 length of array) and the persistReducer doesnt work again. Is there any problem? I already increased AyncStorage db with 10MB.

This is how i use it:

 tph: persistReducer(
    {
      ...defaultConfig,
      key: 'tph',
      whitelist: ['tphAll'],
    },
    tphReducer,
  ),

tphReducer.tphAll is from webservice

RaffayHusayn commented 1 year ago

Are you using a single key to store all of that data? That might be the reason. The windowBuffer size to a single read is around 2MB and you might be going over that. This is what was happening with me. One good way to figure this out is to see if the issue is only present on Android, that's where the limit exist. If it's not happening in iOS then it is very likely that you are going over SQLite cursor window size for a single entry