Memo over an error boundary output: a rejection during a held change halts uncaught

Đã đóng
#4,640 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
18/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ệ
javascript, typescript
Lĩnh vực
frontend

Hướng nghiên cứu

Start with the reproduction in the issue: createErrorBoundary wrapping a memo over a promise, then a memo over the boundary output, flushed during a held change. Compare the render-effect-reads-boundary case, which works, with the memo case, which halts. The scheduler's handling of held changes and rejected sources in the signals package is where the fix would live. Done means the second rejection is caught by the boundary, the render effect shows ERR, and nothing escapes as an uncaught error.

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

Mô tả

A memo over an error boundary's output halts the scheduler when the boundary's source rejects during a held change. The rejection escapes as an uncaught error, and the screen stays on the old value instead of showing the boundary's fallback. If the render effect reads the boundary output directly, the fallback shows as expected.

import { createErrorBoundary, createMemo, createRenderEffect, createRoot, createSignal, flush, untrack } from "@solidjs/signals";

const asks = [];
let screen = "-";
const [sel, setSel] = createSignal(3);
createRoot(() => {
  const detail = createMemo(() => { sel(); return new Promise((res, rej) => asks.push({ res, rej })); });
  const shown = untrack(() => createErrorBoundary(() => detail(), () => "ERR"));
  const t = createMemo(() => shown());            // remove this memo and it works
  createRenderEffect(() => t(), v => { screen = v; });
});
// settle first ask with "A"  -> screen "A"
// setSel(1); flush()         -> held change, screen "A"
// reject second ask "boom"   -> uncaught "boom", screen stays "A" (expected "ERR")
shape after reject
render effect reads the boundary output directly ERR
render effect reads a memo over the output uncaught boom, screen A

The same uncaught error shows up when the memo is read under a <Loading> (without on). The bug is on next. Review of #4639 found it while probing error boundaries built outside a Loading.


Generated by Claude Code

Ngôn ngữ chính
TypeScript
Star
36.2k
Fork
1.1k
Merge trung bình
10 giờ 10 phút
Pull request đã merge (30 ngày)
505

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 solidjs/solid

Tất cả issue của solidjs/solid

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.