refactor: hook dependencies name everything the hooks read

The 12 react-hooks/exhaustive-deps warnings the gate let through:
- ShareDialog and YearFilter built a fresh [] per render while their query loaded, so their
  memos recomputed on every render; they share one empty list now.
- VideoEditor's drag effect called a seek/moveBoundary recreated each render; both are stable
  callbacks in its deps.
- WizardProvider re-checks onboarding on exactly the fields it reads (not the me object, whose
  60 s refetch would reopen a closed wizard).
- Channels, Feed and PlexPlayer list the stable values they already used.
- The player's keydown effect is bound once on purpose (its helpers read refs): said so, with a
  disable, as the codebase's other deliberate sites do.
- dialogFocus and the YouTube player's cleanup read refs React may already have let go of; they
  use what they captured when the effect ran.
This commit is contained in:
2026-09-17 02:45:19 +02:00
parent 5883ea509d
commit 569190480d
10 changed files with 66 additions and 32 deletions
+12 -2
View File
@@ -51,9 +51,19 @@ export function WizardProvider({ children }: { children: ReactNode }) {
// First-login onboarding: prompt the user to connect YouTube (and resume the flow after each
// consent redirect). Re-checked when the account or its grants change.
// Keyed on the fields that matter, NOT the `me` object: the 60 s refetch hands out a new object,
// and re-running on that would reopen a wizard the user just closed. `can_write` is read by nothing
// here but is a trigger: a completed write grant resumes the flow.
const meId = me?.id;
const canRead = me?.can_read;
const canWrite = me?.can_write;
const isDemo = me?.is_demo;
const googleEnabled = me?.google_enabled;
useEffect(() => {
if (me && shouldAutoOpenOnboarding(me)) setOpen(true);
}, [me?.id, me?.can_read, me?.can_write]);
if (meId == null || canRead == null) return;
const account = { can_read: canRead, is_demo: isDemo, google_enabled: googleEnabled };
if (shouldAutoOpenOnboarding(account)) setOpen(true);
}, [meId, canRead, canWrite, isDemo, googleEnabled]);
const actions = useMemo<WizardActions>(
() => ({ openWizard, closeWizard }),