Skip to content

persistWithLocalStorage - Failed to execute 'setItem' on 'Storage' REACT_QUERY_OFFLINE_CACHE exceeded the quota #1701

@cliffordfajardo

Description

@cliffordfajardo

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:

  1. 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
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions