Release Kaleido Desktop 0.1.0-beta.13
All checks were successful
Validate Kaleido Desktop / validate (push) Successful in 1m24s
All checks were successful
Validate Kaleido Desktop / validate (push) Successful in 1m24s
- Automatic intro/credits skip waits a configurable delay (default 5 s) with a filling "Skipping intro" button; pausing, seeking or pressing a key cancels it, and seeking into an intro never auto-skips it. - Watch-state queries refetch on window focus, and Continue Watching / next episode poll every minute while visible, so progress from other Plex apps shows up. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
9729755dc9
commit
328a93695a
15 changed files with 139 additions and 24 deletions
|
|
@ -15,6 +15,18 @@ export const queryClient = new QueryClient({
|
|||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* Watch state changes from other Plex apps too (a TV, a phone), so the queries that show
|
||||
* it refresh when Kaleido comes back into view and, for the progress rows, every minute
|
||||
* while it is on screen. Polling pauses while the window is hidden or minimised.
|
||||
*/
|
||||
export const WATCH_STATE = { refetchOnWindowFocus: true } as const;
|
||||
export const PROGRESS = { ...WATCH_STATE, staleTime: 15_000, refetchInterval: 60_000 } as const;
|
||||
|
||||
// React Query treats a visibility change as focus. Switching back to Kaleido from another
|
||||
// app doesn't change visibility, so a window focus counts as well.
|
||||
window.addEventListener('focus', () => queryClient.getQueryCache().onFocus());
|
||||
|
||||
/** Every key starts with the server so switching servers never mixes caches. */
|
||||
export function useKey(...parts: unknown[]) {
|
||||
const server = useServer();
|
||||
|
|
@ -37,9 +49,9 @@ export function useSectionFor(kind: 'movie' | 'show'): { section: Section | null
|
|||
}
|
||||
|
||||
export const useItem = (id: string | undefined, opts: Partial<UseQueryOptions<Item>> = {}) =>
|
||||
useServerQuery(['item', id], (s) => api.metadata(s, id!), { enabled: !!id, staleTime: 30_000, ...opts });
|
||||
useServerQuery(['item', id], (s) => api.metadata(s, id!), { enabled: !!id, staleTime: 30_000, ...WATCH_STATE, ...opts });
|
||||
|
||||
export const useChildren = (id: string | undefined) => useServerQuery(['children', id], (s) => api.children(s, id!), { enabled: !!id, staleTime: 30_000 });
|
||||
export const useChildren = (id: string | undefined) => useServerQuery(['children', id], (s) => api.children(s, id!), { enabled: !!id, staleTime: 30_000, ...WATCH_STATE });
|
||||
|
||||
export const useRelated = (id: string | undefined) => useServerQuery(['related', id], (s) => api.related(s, id!), { enabled: !!id, staleTime: 10 * 60_000 });
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue