Unawaited state updates in web settings and remote-assignment tests throw after happy-dom teardown under high worker concurrency

Aperta
#1,915 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
react, tailwindcss, typescript
Ambito
testing-qa

Direzione di ricerca

Start with the two test files named in the issue: apps/web/src/routes/_app/admin/tests/settings.test.tsx (the autosave onSuccess timer and the unmount effect around settings.tsx:161-166) and apps/web/src/routes/_app/session/tests/remote-assignment.test.tsx at the two redirect-URL tests near lines 238 and 250. Reproduce by running the apps/web unit tests under high worker concurrency. Done means the timer is cleared on unmount or the tests wait for the post-submit state to settle, with no uncaught window errors across repeated runs.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Area: Web Bug Difficulty: Low Priority: Low

Under high Vitest worker concurrency (reproduced on a 32-core Linux host where pnpm test:coverage spawns 31 workers), two apps/web unit test files intermittently fail the run with an uncaught ReferenceError: window is not defined inside React (resolveUpdatePriority in react-dom-client.development.js:944:7) when a state update fires after happy-dom has torn down window:

  1. apps/web/src/routes/_app/admin/settings.tsx:92 (apps/web/src/routes/_app/admin/__tests__/settings.test.tsx): autosave's onSuccess callback schedules savedTimerRef.current = setTimeout(() => setSaveState('idle'), 2000), and the unmount useEffect at lines 161–166 clears durationDebounceRef.current without clearing savedTimerRef.current. Under worker contention, worker teardown can cross the 2s mark and run setSaveState('idle') after window is gone.
  2. apps/web/src/routes/_app/session/__tests__/remote-assignment.test.tsx:238,250: both redirect-URL tests call submitForm() and return as soon as await waitFor(() => expect(mocks.mutateAsync).toHaveBeenCalled()) passes, before onSubmit and @douglasneuroinformatics/libui's Form handleSubmit (Form.js:87:13) finish their post-submit setState microtasks (compare createAssignment at line 124, which waits for the rendered Assignment Link).
Lingua principale
TypeScript
Stelle
119
Fork
19
Merge medio
1g 18h
PR unite (30g)
61

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di DouglasNeuroInformatics/OpenDataCapture

Tutte le issue di DouglasNeuroInformatics/OpenDataCapture

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.