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

Abierto
#1,915 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
react, tailwindcss, typescript
Área
testing-qa

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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).
Lenguaje dominante
TypeScript
Estrellas
119
Forks
19
Merge medio
1 d 18 h
PR fusionados (30 d)
61

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de DouglasNeuroInformatics/OpenDataCapture

Todos los issues de DouglasNeuroInformatics/OpenDataCapture

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.