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

Đang mở
#1,915 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
react, tailwindcss, typescript
Lĩnh vực
testing-qa

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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).
Ngôn ngữ chính
TypeScript
Star
119
Fork
19
Merge trung bình
1 ngày 18 giờ
Pull request đã merge (30 ngày)
61

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của DouglasNeuroInformatics/OpenDataCapture

Tất cả issue của DouglasNeuroInformatics/OpenDataCapture

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.