perf(web): pause hidden live polling
This commit is contained in:
@@ -4,6 +4,14 @@ export const QUERY_MEMORY = {
|
||||
summaryGcTime: 60_000
|
||||
} as const;
|
||||
|
||||
// Live views must not spend traffic while the browser tab is hidden, but they
|
||||
// should reconcile immediately when an operator returns instead of waiting for
|
||||
// the next interval tick.
|
||||
export const LIVE_QUERY_POLICY = {
|
||||
refetchIntervalInBackground: false,
|
||||
refetchOnWindowFocus: true
|
||||
} as const;
|
||||
|
||||
export function retainPreviousPageWithinScope<T>(scope: string, scopeIndex = 1) {
|
||||
return (previous: T | undefined, previousQuery?: { queryKey: readonly unknown[] }) => previousQuery?.queryKey[scopeIndex] === scope ? previous : undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user