Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[2.0 rc.14 / next] SSR: a rejection contained by `<Errored>` is still an unhandled rejection when an async sibling shares its children slot (exits Node)

已关闭 适合新手
#3,973 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
66/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
nodejs, typescript
领域
frontend

调研方向

错误在 packages/solid/src/server/signals.ts 中的 createErrorBoundary 里抛出,那里创建了合并的 Promise.all(pending.p) 并以 NotReadyError 的形式抛出。请从那里开始,检查当同级节点让插槽保持 pending 时,为什么没有任何代码等待这个 Promise。运行 issue 中的复现步骤,它应当显示 Error: boom 作为未处理的拒绝。完成的标准是:不再报告未处理的拒绝,HTML 输出保持不变,并且仍然渲染 Errored 回退内容。

由索引模型根据 Issue 内容生成。

描述

Summary

During renderToStream, an async read that rejects under <Errored> is contained (the fallback renders), but the rejection is also left unhandled when the boundary shares a {props.children} slot with an async sibling. Node's default --unhandled-rejections=throw then ends the process. Another <Errored> around the whole tree does not help: the error is not escaping the render, it is an internal promise nobody handles.

Reproduction
import { renderToStream } from "@solidjs/web";
import { createMemo, Errored, Loading } from "solid-js";
import type { ParentProps } from "solid-js";

const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
process.on("unhandledRejection", (reason) => console.log("unhandled:", String(reason)));

function Layout(props: ParentProps) {
  return <main>{props.children}</main>;
}
function Fails() {
  const value = createMemo(async () => {
    await delay(5);
    throw new Error("boom");
  });
  return <p>{value()}</p>;
}
function Later() {
  const value = createMemo(async () => {
    await delay(20);
    return "later";
  });
  return <p>{value()}</p>;
}

renderToStream(() => (
  <Loading fallback={<p>loading</p>}>
    <Layout>
      <Errored fallback={(_error) => <p>failed</p>}>
        <Fails />
      </Errored>
      <Later />
    </Layout>
  </Loading>
)).then((html) => console.log(html));
HTML unhandledRejection
as above <main><p>failed</p><p>later</p></main> Error: boom
wrapped in another <Errored> same Error: boom
<Later /> removed <main><p>failed</p></main> none
<Later /> after </Layout> <main><p>failed</p></main><p>later</p> none
no <Layout> (both directly in <Loading>) <p>failed</p><p>later</p> none

Without the handler, Node exits. Reproduces on 2.0.0-rc.14, also with #3936 applied; the code below is unchanged on next.

Cause

The server boundary's resolve (packages/solid/src/server/signals.ts, createErrorBoundary) throws a combined promise while its holes are pending:

const all: any = Promise.all(pending.p);
if (pending.p.some(p => (p as any).$clientHole)) all.$clientHole = true;
throw new NotReadyError(all);

When the sibling keeps the slot pending and the slot is retried, nothing awaits that all any more, so its rejection is reported even though the boundary handled the error and rendered its fallback.

Expected

A rejection that <Errored> contains is handled, as for a rejecting direct child of <Loading> (#3570, #3594) and in the browser (#3769).

Possible fix

Mark the combined promise handled where it is created; whoever awaits it still sees the rejection:

const all: any = Promise.all(pending.p);
all.catch(() => {});

With that line in rc.14's dist/server.dev.js, the reproduction reports no unhandled rejection and renders the same HTML.

(submitted by Claude Opus 5.5 on behalf of rvlzzr)

主要语言
TypeScript
星标
36.1k
派生
1.1k
平均合并
10 小时 44 分钟
30 天内合并 PR
339

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

solidjs/solid 的其他 Issue

查看 solidjs/solid 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。