rt2zz / redux-persist

persist and rehydrate a redux store
MIT License
12.93k stars 866 forks source link

Exceeding storage quota #870

Open YCMitch opened 6 years ago

YCMitch commented 6 years ago

Hey there,

I'm encountering the following error, after running my app for a certain amount of time: Failed to execute 'setItem' on 'Storage': Setting the value of 'persist:primary' exceeded the quota.

Has anyone seen this before? I presume the cached data is over the localStorage quota, but seeing the quota is 10mb for Chrome, I find pretty difficult to believe, unless something bizarre is going on.

Is there a means of perhaps console logging the total contents of the persisted store data?

MilllerTime commented 6 years ago

You can type localStorage and hit enter in your browser console. Alternatively you can view the Local Storage section of the "Application" tab in Chrome dev tools. Both methods will reveal the entirety of what is being held in localStorage for the current domain.

dhwrwm commented 5 years ago

I got this same error. screenshot 2019-03-01 at 10 02 37 am

naisargparmar commented 5 years ago

I am also getting same error..How to clear local storage data programatically.?

FrenchBully commented 5 years ago

any updates on this error?

naisargparmar commented 5 years ago

@FrenchBully Hi u can use localStorage.removeItem(key);

prasanthyejje commented 4 years ago

@naisargparmar @dhwrwm @MitchEff did you get any solution for this.

YCMitch commented 4 years ago

Kind of. The storage limit obviously can't be changed, but if you're filling up your storage limit, there may be other causes.

We've found:

Hope that helps. It's not a perfect answer, but if your localStorage is full, you've most likely done something wrong.

naisargparmar commented 4 years ago

@prasanthyejje I am using localStorage.removeItem(key) to clear storage. or u can generate multiple different keys under localStorage. Also @MitchEff said Storage limit can't be changed. so try to generate different keys under localStorage or clear storage.

fabellonnoe commented 4 years ago

try to limit the data that you are fetching, in my case I have 57 data that's why I set an offset and limit to make it 20 and then I added a load more button to load the other 20 and so on

PavanKumarRao commented 4 years ago

any solution for this? I tried remove item , it didnt work

yarokon commented 4 years ago

Fix for Web:

$ yarn add localforage

import localforage from 'localforage';

const persistConfig = {
    key: 'root',
    storage: localforage,
};
ravigandikote commented 4 years ago

@yarokon .. Thanks .. that worked for me !!

sidalii commented 3 years ago

thanks @yarokon

afleissner2019 commented 3 years ago

Hello Everyone,

I have received same error message but only on the website console. But the website is working perfectly fine. I am using Redux and Sentry. Do you think is a BUG? Error

captainkovalsky commented 2 years ago

@yarokon thanks for fix, btw how to write migration for that?

haveamission commented 2 years ago

Kind of. The storage limit obviously can't be changed, but if you're filling up your storage limit, there may be other causes.

We've found:

  • This is often caused by issues with Redux/Normalizr accidentally causing exponential memory leaks - some of our entities would have arrays of relationships with 100,000 of the same object, cause it's pushed/mutated every render, or something like that
  • Purging the persistor after logging in stops these things getting out-of-hand - once we've got a fresh set of data from the API, the persisted data is no longer relevant. If we clear it each time (and there's no normalization issues), it doesn't creep up in size.

Hope that helps. It's not a perfect answer, but if your localStorage is full, you've most likely done something wrong.

How do you purge the persistor?

prasanthyejje commented 2 years ago

@yarokon thanks localforage is working fine for me.