Repository navigation
Refetch polling queries on window focus - #3480
Open
david-crespo wants to merge 2 commits into
Open
david-crespo wants to merge 2 commits into
david-crespo wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
david-crespo
enabled auto-merge (squash)
December 4, 2026 15:10
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Some pages that poll do it pretty slowly in some conditions. For example, on the update page, when nothing has happened in 30 minutes, we slow down to polling every 2 minutes.
console/app/pages/system/UpdatePage.tsx
Lines 54 to 75 in 7df7f23
But polling also pauses when the page loses focus. So you might leave the page sitting for an hour, then come back, and you expect it to have polled in that time, but it does not, and unless the poll tick happens to fire in the 10 seconds you are there staring at it, you will not get another poll. It doesn't queue up the next poll to fire when you look or anything. So essentially unless you sit on the page for up to two minutes (which no one would do), it looks broken.
Luckily there is an extremely easy fix: React Query has a
refetchOnWindowFocusflag that we have off by default because generally we try to keep the site behaving like a traditional server-rendered app, but on pages that poll (instances, support bundles, update) that expectation is surely suspended. So we turn it on. I also cut the polling interval from 2 minutes to 1 minute.