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

persistReducer only works for very small sized data

Open prieyudaarvis opened this issue 2 years ago • 1 comments

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

prieyudaarvis avatar Oct 03 '22 11:10 prieyudaarvis

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

RaffayHusayn avatar Jan 03 '23 19:01 RaffayHusayn