fix(header): keep the sync-status count live (focus refetch + background poll)
The header 'N without full history' (and sync state) polled every 30s but only while the tab was focused, and the global refetchOnWindowFocus is off — so after switching tabs the count looked frozen until a manual reload. Poll in the background too and refetch on focus so it tracks the scheduler's progress without F5.
This commit is contained in:
parent
ddb1890e84
commit
4ff0b9705c
1 changed files with 5 additions and 0 deletions
|
|
@ -20,7 +20,12 @@ export default function SyncStatus({
|
||||||
const { data } = useQuery({
|
const { data } = useQuery({
|
||||||
queryKey: ["my-status"],
|
queryKey: ["my-status"],
|
||||||
queryFn: api.myStatus,
|
queryFn: api.myStatus,
|
||||||
|
// Track the scheduler near-real-time: poll even when the tab is backgrounded, and
|
||||||
|
// refresh immediately on tab focus (the global default disables focus refetch), so the
|
||||||
|
// "N without full history" count keeps ticking down without a manual reload.
|
||||||
refetchInterval: 30_000,
|
refetchInterval: 30_000,
|
||||||
|
refetchIntervalInBackground: true,
|
||||||
|
refetchOnWindowFocus: true,
|
||||||
staleTime: 25_000,
|
staleTime: 25_000,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue