bjoluc/next-redux-cookie-wrapper

What happens if we store subtrees in cookie whose size exceeds 4096 bytes ?

phatify opened this issue · 1 comments

what happens if we store subtrees in cookie whose size exceeds 4096 bytes ?
Is that an efficient way to persist state?

image

what happens if we store subtrees in cookie whose size exceeds 4096 bytes ?

I don't know how browsers handle this in particular, but chances are something will go wrong when saving the cookie...

Is that an efficient way to persist state?

For large amounts of state, you should consider using Redux Persist. You could technically split large subtrees into multiple cookies, but that doesn't make cookies any more efficient. Alternatively, if you can infer pieces of your state (for instance by loading them from a database), it may be an option to sync relevant state portions with cookies and just dynamically fetch missing pieces.