Easy-peasy: Control persist rate

Created on 20 Apr 2020  路  6Comments  路  Source: ctrlplusb/easy-peasy

Hi,
I have a couple of big objects in the store and I am using persists with local forage. Serializations are blocking the main thread. Is there any option to mitigate this issue? There are missing APIs from redux-persist like a throttle. I don't know if that API helps or just delays the problem :)

new-feature

Most helpful comment

@aalpgiray - there is a store.persist.clear() api. 馃檹

All 6 comments

main thread

There is no such thing as threads in js. There is always only one thread

@aalpgiray - I plan to expose more configuration around this so that you can be in control of the persist rate. Currently it is fixed at attempting to persist every second. This is perhaps a bit overambitious for your case. I'll make sure to get it into the v3.4.0 alpha for you soon. 馃挏

I don't know if that API helps or just delays the problem

I think alternative approaches can be take, like requestAnimationFrame or requestIdleCallback to schedule the persists in a more kind manner.

How can we purge all persisted values and stored state?

@aalpgiray - there is a store.persist.clear() api. 馃檹

it is not available in typescript defs. Or have I missed something.

Was this page helpful?
0 / 5 - 0 ratings