T
TanStack3y ago
ambitious-aqua

How to disable background refetching globally

Hi, we are doing a frontend application which doesnt require polling for new data in the background, how can we disable this setting for the entire application as a default(if we have dynamic data we would surely enable background refresh for certain queries)
2 Replies
yappiest-sapphire
yappiest-sapphire3y ago
react-query doesn't "poll", it triggers refetches on specific heuristics, like window focus events or component mounts. this only happens for stale queries, so your best bet would be to set staleTime: Infinity on the default settings
ambitious-aqua
ambitious-aquaOP3y ago
thanks

Did you find this page helpful?