refetchIntervalInBackground
I have refetchIntervalInBackground set to false, but I'm trying to figure out what "background" actually means? Does it mean "not focused"?
I have the following code:
Just as a contrived example, I'm seeing it is still incrementing when I click away from the tab, but is that actually in the background?
5 Replies
like-gold•3y ago
window not focused / visible
harsh-harlequinOP•3y ago
window + tab?
let me make a codesandbox, I swear this may be bug...
like-gold•3y ago
this is the only place where we use
refetchIntervalInBackground
https://github.com/TanStack/query/blob/457723f2cd47a460d351d695d94bff962e7f68e5/packages/query-core/src/queryObserver.ts#L371-L376GitHub
query/packages/query-core/src/queryObserver.ts at 457723f2cd47a460d...
🤖 Powerful asynchronous state management, server-state utilities and data fetching for the web. TS/JS, React Query, Solid Query, Svelte Query and Vue Query. - query/packages/query-core/src/queryObs...
like-gold•3y ago
focusManager just checks:
harsh-harlequinOP•3y ago
ahhh i think that's the discrepancy, our useIsWindowFocused hook just has an event listener for window.focus, window.blur... whereas it looks like react query is using visibilityState which is a little different, thanks!