Describe the bug
After loading our app and browsing our a few pages (which make useQuery calls) we get a localStorage error.
Uncaught DOMException: Failed to execute 'setItem' on 'Storage': Setting the value of 'REACT_QUERY_OFFLINE_CACHE' exceeded the quota.
These are the options I am using for the query config, essentially using defaults options where throttleTime is 1000
const queryClient = new QueryClient({
defaultOptions: {
queries: {
useErrorBoundary: true,
refetchOnWindowFocus: false,
cacheTime: 1000 * 60 * 60 * 24,
},
},
});
persistWithLocalStorage(queryClient);
To Reproduce
Steps to reproduce the behavior:
- Use the app with persistWithLocalStorage enabled
Expected behavior
Should't error, we may need a new default value for the throttle time in options
Screenshots

UPDATES & follow up comment
This error
Uncaught DOMException: Failed to execute 'setItem' on 'Storage':occurs when attempting to write data when localStorage if full (past 5MB limit)Community Feedback / Proposed Ideas for Solutions?#
For anyone else who see's this; would love to hear your thoughts & bounce ideas 💭
When we get the exception from localStorage, inside the
catchblock, perhaps we allow the user to provide different cache eviction options passed in the OptionsSome ideas that I think may satisfy the majority of people's needs?
react-query's localStorage completely when we git this error.Previous work Some popular LRU cache libraries & their options/API
excludeoption here when doing an evicationAn example of filling localStorage up