TanStackT
TanStack15mo ago
10 replies
primary-violet

Issue in understanding one of the examples in tanstack/query (playground example)

Hi all, I was playing with the example in the docs https://tanstack.com/query/latest/docs/framework/react/examples/playground
we are setting gcTime explicitly in the
React.useEffect(() => {
    queryClient.setDefaultOptions({
      queries: {
        staleTime,
        gcTime,
      },
    })
  }, [gcTime, staleTime])

for all the queries showing in the devTools, it seems gcTime is not taking effect, checked from devTools, its showing as default of 5 mins(ideally it should be what we have set from the textbox)
can someone help me figure this out why its not being set by the useEffect?
Headless, type-safe, powerful utilities for complex workflows like Data Management, Data Visualization, Charts, Tables, and UI Components.
TanStack | High Quality Open-Source Software for Web Developers
Preview image
Was this page helpful?