[2.0.4] Nested `<Errored>`: the outer boundary stays on an error the inner one rethrew, after the next error is one the inner one handles
Maintainer thường phản hồi trong vòng 1 ngày
@MilindChatrabhuji đang làm issue này rồi.
Từ ngày 28/11/2026.
- #5269 của @MilindChatrabhuji — đang mở
Đá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
- 25/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, typescript
Hướng nghiên cứu
Start by reading the error-boundary logic in boundaries.ts, then run the linked Solid playground and the @solidjs/signals reproduction to compare async and synchronous failures. Focus on prune, catchStatus, and how an errored reader is retained by the outer <Errored> boundary. Done means the outer fallback switches to the inner TooLong result after the async error, while the synchronous behavior remains correct and regression coverage is added.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Two nested error boundaries: the inner one handles TooLong and rethrows anything else, the outer one shows whatever reaches it. The content first fails with NotFound, and the outer boundary shows it, which is right. When the content then fails with TooLong after an async step, the inner boundary should take over. Instead the outer boundary keeps showing NotFound until the content produces a value again. The same change done synchronously recovers.
Reproduction
Open in the Solid playground (2.0.4)
import { createSignal, createMemo, Errored } from "solid-js";
class NotFound extends Error {}
class TooLong extends Error {}
// Answers after 500 ms.
const fetchUser = (id: string) =>
new Promise<string>((res, rej) =>
setTimeout(() => {
if (id === "missing") rej(new NotFound());
else if (id === "long") rej(new TooLong());
else res("user " + id);
}, 500)
);
export default function App() {
const [id, setId] = createSignal("1");
const user = createMemo(() => fetchUser(id()));
return (
<>
<button onClick={() => setId("missing")}>1. not found</button>
<button onClick={() => setId("long")}>2. too long</button>
<button onClick={() => setId("2")}>3. found</button>
<Errored fallback={e => <p>outer: {(e() as Error).constructor.name}</p>}>
<Errored
fallback={e => {
if (!(e() instanceof TooLong)) throw e(); // only TooLong is handled here
return <p>inner: TooLong</p>;
}}
>
<p>{user()}</p>
</Errored>
</Errored>
</>
);
}
Steps
- Wait for
user 1. - Click 1. not found:
outer: NotFound. - Click 2. too long.
- Click 3. found.
Expected
inner: TooLong after step 3: TooLong is caught by the inner boundary, so the outer one has nothing left to show.
Actual
| after step | shown |
|---|---|
| 2 | outer: NotFound |
| 3 | outer: NotFound (expected inner: TooLong) |
| 4 | user 2 |
With a synchronous memo (createMemo(() => check(id())), throwing the same errors), step 3 shows inner: TooLong. Same in 2.0.4 and main (510bb8d01), and with a third, untyped <Errored> above.
It needs all three: the value is pending between the two errors, the inner boundary is created inside the outer one's content (as JSX nesting does), and the failing read is in a render effect (as insert does).
The same at the @solidjs/signals level
import { createRoot, createSignal, createMemo, createRenderEffect, createErrorBoundary, flush } from "@solidjs/signals";
class NotFound extends Error {}
class TooLong extends Error {}
const settle = async () => { for (let i = 0; i < 4; i++) { await new Promise(r => setTimeout(r)); flush(); } };
const [id, setId] = createSignal("1");
const check = v => { if (v === "missing") throw new NotFound(); if (v === "long") throw new TooLong(); return "ok"; };
let screen;
createRoot(() => {
const user = createMemo(async () => check(await Promise.resolve(id())));
const outer = createErrorBoundary(
() => createErrorBoundary(
() => { const node = {}; createRenderEffect(user, v => { node.text = v; }); return node; },
err => { if (!(err() instanceof TooLong)) throw err(); return { text: "inner: TooLong" }; }
),
err => ({ text: "outer: " + err().constructor.name })
);
createRenderEffect(() => { let v = outer; while (typeof v === "function") v = v(); return v; }, v => { screen = v; });
});
const seen = [];
await settle(); seen.push(screen.text);
setId("missing"); await settle(); seen.push(screen.text);
setId("long"); await settle(); seen.push(screen.text);
console.log(seen.join(" | ")); // ok | outer: NotFound | outer: NotFound (expected … | inner: TooLong)
Run with node --conditions=browser --conditions=development repro.mjs.
Cause
In boundaries.ts: while the outer boundary shows its fallback, the render effect goes pending and catchStatus records it as a reader at the outer boundary. When it then fails with TooLong, catchStatus stops at the inner boundary, which handles it, so the outer one is never updated. The outer boundary's prune keeps any reader with STATUS_ERROR, even one a boundary below has handled, so it stays on its fallback. The synchronous case never records the reader at the outer boundary.
A likely fix is the error-side counterpart of caughtBelow: in prune, an error boundary doesn't keep an errored reader that an error boundary below it has recorded.
- Ngôn ngữ chính
- TypeScript
- Star
- 37k
- Fork
- 1.2k
- Merge trung bình
- 8 giờ 43 phút
- Pull request đã merge (30 ngày)
- 365
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của solidjs/solid
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 38/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[2.0.4] A waiting action started from a cleanup holds back an effect's write that reacts to the same landing (follow-up to #5251)Có thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 38/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của solidjs/solid
Issue tương tự
-
agents-window vscode api adoption
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
alefragnani/vscode-copy-word#126 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
opensro-dev/opensro#4949 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:linux priority:high
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
fa0311/better-tokuly#1204 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
saltbo/zpan#883 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement impeccable priority: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
nledford/Ladderback#1891 ·
Maintainer thường phản hồi trong vòng 1 ngày