[2.0 rc.11] 当渲染失败之前,createSSRResponse 从未完成,shell 也未进行清空
作者: everton-dgn创建于 2026年9月30日更新于 2026年9月30日
// repro.mjs: plain Node ESM, no JSX, no build step. Needs [email protected] and @solidjs/[email protected] (Node picks dist/server.js). Usage: node repro.mjs
import { Loading, NotReadyError, createMemo } from "solid-js";
import {
createRequestEvent,
createSSRResponse,
escape,
renderToStream,
scope,
ssr,
ssrHydrationKey
} from "@solidjs/web";
const [tree = "root", consumer = "response"] = process.argv.slice(2);
const delay = (ms, value) => new Promise(r => setTimeout(() => r(value), ms));
// root:
{data()}
, no or above the read. const RootRejection = () => { const data = createMemo(async () => { await delay(10); throw new Error("fetch failed"); }); const p = ssr(["", ""], ssrHydrationKey(), scope(() => escape(data()))); return ssr(["", ""], ssrHydrationKey(), escape(p)); }; // loading:{held()}
// The #3569 (b) shape: the boundary trips its convergence budget while a root
// read still holds the shell, and it has no parent handler.
const NeverConverges = () => {
throw new NotReadyError(Promise.resolve());
};
const LoadingFailure = () => {
const held = createMemo(() => delay(200, "shell"));
return ssr(
["", "", ""],
ssrHydrationKey(),
scope(() => escape(held())),
escape(Loading({ fallback: "loading", get children() { return NeverConverges(); } }))
);
};
const timer = setTimeout(() => {
console.log("still pending after 3000 ms");
process.exit(1);
},
…内容来源: solidjs/solid