feat(channel): live-refresh the channel page while full-history backfills
The channel detail page now polls (via useLiveQuery) while THIS user's full-history backfill is running (deep_requested && !backfill_done), so the stored count and the N/S/L breakdown climb on their own as the scheduler adds videos — no manual F5 — and it stops polling once the back-catalogue is in. Widen useLiveQuery's interval callback to allow returning `false` (stop) so "poll while active, stop when done" is a first-class, reusable cadence.
This commit is contained in:
@@ -9,10 +9,13 @@ export function useLiveQuery<T>(
|
||||
key: QueryKey,
|
||||
queryFn: () => Promise<T>,
|
||||
// intervalMs may be a function of the latest data, so the poll cadence can adapt to it
|
||||
// (e.g. poll faster while a job is running). react-query re-evaluates it after each fetch
|
||||
// against fresh data — the right place for this, vs. a React state toggle that can lag or
|
||||
// stall the live updates.
|
||||
opts: { intervalMs?: number | ((data: T | undefined) => number); enabled?: boolean } = {},
|
||||
// (e.g. poll faster while a job is running, and return `false` to STOP once it's done).
|
||||
// react-query re-evaluates it after each fetch against fresh data — the right place for this,
|
||||
// vs. a React state toggle that can lag or stall the live updates.
|
||||
opts: {
|
||||
intervalMs?: number | false | ((data: T | undefined) => number | false);
|
||||
enabled?: boolean;
|
||||
} = {},
|
||||
) {
|
||||
const { intervalMs = 4000, enabled = true } = opts;
|
||||
return useQuery({
|
||||
|
||||
Reference in New Issue
Block a user