Skip to main content

Important defaults

A summary from https://tanstack.com/query/latest/docs/react/guides/important-defaults

PropertiesDefaultDesc
staleTime0 (ms)cache data is considered as stale by default
gcTime5x60x1000ms (5m)the time when inactive queries are garbage collected
retry / retryDelay3 / 1s-2s-4sfailed queries will auto retried
refetchOnMounttruerefetch if the new instance of query mount
refetchOnWindowFocustruerefetch if the window is refocused
refetchOnReconnecttruerefetch if the network is reconnected
refetchIntervalN/Aoptional, trigger refetch until a condition is met

Demo
Edit simple-query-test

Notes
  • Cache data is considered as stale unless you specify the staleTime
  • Query may not be refetch quite a lot during development, due to refetch configs.