diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 316690b..b4ef87c 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -62,7 +62,16 @@ import { } from "lucide-react"; const queryClient = new QueryClient({ - defaultOptions: { queries: { retry: 1, refetchOnWindowFocus: false } }, + defaultOptions: { + queries: { + retry: 1, + refetchOnWindowFocus: false, + // Pause interval-based refetches (widgets ~30s, queue status 5s, + // media build progress 1s) when the tab is hidden. Saves battery on + // mobile (D8 follow-up). Build progress polls resume on return. + refetchIntervalInBackground: false, + }, + }, }); function useDarkMode() { diff --git a/frontend/src/hooks/useMedia.ts b/frontend/src/hooks/useMedia.ts index bd7b273..2b89d7a 100644 --- a/frontend/src/hooks/useMedia.ts +++ b/frontend/src/hooks/useMedia.ts @@ -14,7 +14,10 @@ export function useMediaStatus(jellyfinServiceId?: string) { staleTime: 5_000, refetchInterval: (query) => query.state.data?.build_running ? 1000 : false, - refetchIntervalInBackground: true, + // Inherit the default refetchIntervalInBackground: false — pause the + // 1s build-progress poll when the tab is hidden. The build keeps + // running server-side; the poll resumes and catches up on return. + // Battery-friendly (D8 follow-up). }); }