Repository navigation
fix(solid, web): an Errored draws its fallback in the shell when a nested Loading fails before the shell is sent - #5225
Merged
ryansolid merged 1 commit intoNov 27, 2026
Conversation
…sted Loading fails before it (solidjs#4287, solidjs#4303) solidjs#4303 drew the Errored fallback only when the failing Loading is all of the Errored's content. With markup between them, a sibling beside the Loading, or another Loading inside the Errored, a failure before the shell flush left the content in the shell with the failed Loading's position empty, and the fallback appeared only when the client hydrated. While the renderer still holds the shell, it is now a region container (`ctx.shell`), as a pending Loading fragment is for solidjs#4316: the failing Loading hands the failure up (`ESCALATE`), and an enclosing Errored whose finished markup is in the shell draws its fallback there in place of that markup, its error serialized at the Errored id for the client to adopt. Fragments inlined since that markup rendered, with the settled child fragments spliced into them, are replayed on it to find it. The markup is found by its text, so only markup with a place of its own is replaced: it carries a hydration key or a Loading placeholder and occurs once. An Errored that put nothing or text alone into the page, or that was never inserted, is left as before, and so is the Errored around it: the failure is the client's, never an outer boundary's. The fallback is drawn only when it is finished as it renders: the shell never waits for it. It renders first with the error's default wire value; the server error hook hears `fallback` once it is drawn, and it renders again, at the same ids, when the hook's mapping changes a value it read (what the first render started, a Loading of its own or a serialized value, is joined; only its head registrations are made again). A fallback with an async or client-only hole, or one that throws with no Errored above, is not drawn: what it started is dropped, the shell is as before, the client renders the failure, and the hook hears `client`. A fallback that throws is the next Errored's failure, as for solidjs#4316. One limit: when the second render (with the mapped value) throws or is unfinished, nothing is drawn and the hook has already heard `fallback`. What the replaced content left pending goes with it: its pending Loadings and serialized values, and its head registrations (useHead registrations now carry the registering owner's id), so nothing streams for it and its tags never reach the head. The fallback renders with no fragment current, so its own registrations are the shell's. A failure that no Errored contains for itself (a Loading inside one that already failed, or inside content already replaced) is reported as before, `client`. After the shell flush nothing changes: the nested shape still streams an empty fragment and the client renders the failure. Tests: harness scenarios for the nested pre-flush shapes (element, sibling, settled and pending sibling Loading) with server and hydration specs; server cases for the awaited form, an Errored inside a settled Loading, a sibling Loading settled inside a pending one, a failing fallback with and without an outer Errored, a hook mapping (drawn, a Loading in the fallback keeping its fragment and value, the second render throwing), fallbacks that are async, never settle or have a client-only hole (the shell not delayed, the hook hearing `client`), markup with no place of its own (empty, text alone, an Errored not inserted), failures nothing draws for still reported, and the replaced content's head tags. The two solidjs#2776 Reveal tests now reject after the shell, which is what they exercise; the pre-flush variants are pinned separately, drawn and not drawn. 12-ssr-http.md: the `client` handling note covers the nested pre-shell case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Merging this PR will not alter performance1 warning
Comparing Footnotes
|
yumemi-thomas
added a commit
to yumemi-thomas/solid
that referenced
this pull request
Nov 27, 2026
… Loading fails after the shell (solidjs#5223) The second half of solidjs#5223. Before the shell is sent, the Errored around a nested failing Loading draws its fallback in the shell (solidjs#5225). After it, the Errored's markup is out and has no place of its own: the failed Loading streamed an empty fragment, the page kept the content with that position blank, and only a hydrating client rendered the failure. Nothing is added to the page to mark the region. On the failure, handed up (ESCALATE) before the fragment settles, the nearest Errored whose markup is out asks the renderer where the page has it (`ShellContainer.locate`): the two ends of its node range, each named by what it already carries, a hydration key or a Loading placeholder, with the end of the content that has since replaced a placeholder as a further candidate (recorded as each fragment's content is sent). With both ends named, it renders its fallback as the before-shell path does (`drawInShell`: finished as it renders, or not at all; nothing waits) and the renderer sends it in a template keyed by the Errored id, the error staged at `<id>_ef`, its head registrations parked at the id, and `$dfx(id, first, last, 1)`. `$dfx` (sent once, with the first such fallback) puts the fallback in place of the range only while no client runtime has started (`_$HY.f` unset), with both ends found and the last reachable from the first by nextSibling, and in the same step moves the record to the Errored id: a client finds the fallback and its record together or neither. Otherwise it changes nothing, and the client renders the failure from the rejected channel, as before. It wraps `$dfr` so a fragment of a replaced region that settles later drops its template instead of queueing for a placeholder that is gone. The failed fragment settles as before, and nothing in the region is released: a page that does not take the fallback is the 5ef1abd page. The nearest Errored owns the failure and never passes it up, except when its own fallback fails (solidjs#4316). An Errored inside a region whose fallback already went out declines. The hook hears `fallback` when the fallback is sent, `client` otherwise. Not sent (the client renders the failure, as before): an end with neither a key nor a placeholder (text, NoHydration content, hand-written ssr() with no key), `<html>`/`<head>`/`<body>` as the content's or the fallback's root, a fallback not finished as it renders, a transport sink, noScripts, a server component. No client runtime change. A render without such a failure is byte-identical (every recorded harness artifact but the three nested after-shell failures is unchanged). Tests: test/server/ssr-errored-nested-postflush-5223.spec.tsx parses each stream with jsdom, scripts on, so the parser is part of every assertion: the original shapes, and every repro of the two reviews of the first attempt (tables, document-level and body-level Errored, the never-settling and overtaking fallbacks, the direct-shape inner Errored, a later failure in a replaced region, Reveal groups, head tags, NoHydration, the record, the hook, authored pl-* markup, the shell race). Harness shapes recorded by hydration-harness.spec.tsx and replayed by test/hydration/errored-nested-postflush-5223.spec.tsx (adopted after the stream; rendered by the client from the shell; a later root on a page whose runtime had started) and test/hydration/errored-nested-postflush-review-5223.spec.tsx (the reviews' H1-H6 in three arrival orders). The frame-outcome test that pinned the blank now pins the fallback sent beside it. 12-ssr-http.md: the `client` handling note covers the after-shell case. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
ryansolid
pushed a commit
that referenced
this pull request
Nov 27, 2026
After #5221, #5225, #5228, #5235 and #5236, until/refresh, compiled base server components, base + router and live + router sat 6-92 B brotli over their caps. Caps move to CI's measure on main @ f7b6b9c + 10 B and recorded minified resets to the measure. No floors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWMR7ndYUnqBW5NjTbC
ryansolid
added a commit
that referenced
this pull request
Nov 27, 2026
…cenarios over their caps (#5241) * fix(release): skip already-published packages in artifact verification Since #4985, h, html and element version on their own, so a core release leaves them at a version already on npm. verify-release-artifacts.mjs dry-run-published every public package, and npm refuses even a dry run over a published version, so the 2.0.1 release failed before publishing anything. It now skips a published version the same way release.mjs does, with packageIsPublished shared from release-packages.mjs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWMR7ndYUnqBW5NjTbC * fix(signals): a reader linked to a settled source no longer stays pending on it retryReaches counted a dep that is the source itself as a path even after that source settled, so settleFamily and the re-park sweep in recompute kept a settled derive node in a reader's pending sources. With an optimistic store over one async memo and a slower sibling memo whose re-ask answers unchanged, the reader stayed pending and the action's transaction never landed. A direct link now counts only while the source is pending. Claude-Session: https://claude.ai/code/session_01CP9T3j2CTCEPyTS2bcKsBu * fix(web): send an empty revalidate declaration as a non-empty header * fix(compiler): treat only a leading comment equal to the static marker as the marker * fix(web): a server function's ReadableStream result stays a ReadableStream The top-level abort wrapper for streamed results matched any async iterable, so a decoded ReadableStream (which is one in Node and Chrome) was replaced by a plain iterable and lost getReader/pipeTo/tee. Leave a ReadableStream out of that check; it passes through as it already does when nested. Test shape from #5175. Co-authored-by: Marve10s <igrimanigroman@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWMpyUtA1ZFwzKmr1sg * fix(web): check getReader instead of instanceof ReadableStream The instanceof check with its typeof guard cost +59 B minified on every server-function page and put three page scenarios over their caps. A decoded ReadableStream is told apart from an async generator's result by its getReader method. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWMpyUtA1ZFwzKmr1sg * fix(web): write the empty revalidate header once; digest it to no keys Send `,` in one header write when the joined keys are only whitespace, and digest `X-Revalidate` with empty keys filtered, so an empty declaration reads as `[]` on the outcome instead of `[""]` or `["", ""]`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWMR7ndYUnqBW5NjTbC * fix(release): wait for the dispatched compiler binary run before watching it The 2.0.4 publish stopped at `gh run watch`: `gh workflow run` printed the new run's URL, and watching it one second later returned 404 because the run was not readable yet. Poll `gh run view` until it resolves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWMR7ndYUnqBW5NjTbC * fix(release): poll the compiler binary run instead of gh run watch The 2.0.4 re-run got past the run lookup, then `gh run watch` failed on the run's jobs (HTTP 404) before GitHub had created them. Poll `gh run view --json status,conclusion` until the run completes, retrying failed reads, and check the conclusion. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWMR7ndYUnqBW5NjTbC * fix(signals): a re-parked reader drops a pending source disposed while loading The re-park prune in recompute kept any carried source still flagged STATUS_PENDING, on the assumption that its own settle walk is still to come. A source disposed while loading keeps that flag but never lands, so no walk comes. When a reader parked on an async memo whose owner then re-ran in the same hold, disposing it and creating a replacement that failed, the reader stayed pending on the disposed memo: the hold never landed and its staged error never reached the boundary. A disposed source is now dropped whatever its status, as retryReaches and holdsOn already treat a disposed node as holding nothing (F-3). * chore(size): re-record the six scenarios over their caps on main After the 11-24 fix batch and 2.0.4, six scenarios sat over their brotli caps with 9-14 B of minified allowance left (warnings on main, but the next ~10 B client fix would fail the gate). Caps move to CI's measure on 5420b4a + 10 B and recorded minified resets to the measure. No floors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWMR7ndYUnqBW5NjTbC * chore(signals): pin Sparkplug tiering in the signals bench lane Same flag as the web server lane (#5157). In #5141's fork runs it took the signals lane from one benchmark varying by more than 5% across fresh runners to none, and #4906's omit ownKeys -63% reads 226k vs 235k instructions pinned (673k vs 237k unpinned). Benchmark mode only: the test suite runs in worker threads, which reject V8 flags in execArgv. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWMR7ndYUnqBW5NjTbC * chore(size): re-record the three scenarios over their caps on main After #4906, #5209 and #5218, until/refresh, base server components and live server components sat 5-15 B brotli over their caps, so the size gate failed on every PR. Caps move to CI's measure on main @ 50a4bfd + 10 B and recorded minified resets to the measure. The two page scenarios are frozen floors (floor-caps.json). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWMR7ndYUnqBW5NjTbC * test(signals): gate the affects(list) holder test on a promise, not a 20 ms timer The test checked the marks after three settle() ticks while the action waited on a 20 ms timer. On a loaded CI machine the ticks can outlast the timer, so the action landed first and the check saw [false, false, false] (failed on #5230's CI). The action now waits on a gate the test releases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWMR7ndYUnqBW5NjTbC * chore(size): re-record the four scenarios over their caps on main After #5221, #5225, #5228, #5235 and #5236, until/refresh, compiled base server components, base + router and live + router sat 6-92 B brotli over their caps. Caps move to CI's measure on main @ f7b6b9c + 10 B and recorded minified resets to the measure. No floors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWMR7ndYUnqBW5NjTbC --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: gnovotny <g.novotny@gmx.ch> Co-authored-by: Marve10s <igrimanigroman@gmail.com> Co-authored-by: gnovotny <990945+gnovotny@users.noreply.github.com>
yumemi-thomas
added a commit
to yumemi-thomas/solid
that referenced
this pull request
Nov 27, 2026
… Loading fails after the shell (solidjs#5223) The second half of solidjs#5223. Before the shell is sent, the Errored around a nested failing Loading draws its fallback in the shell (solidjs#5225). After it, the Errored's markup is out and has no place of its own: the failed Loading streamed an empty fragment, the page kept the content with that position blank, and only a hydrating client rendered the failure. Nothing is added to the page to mark the region. On the failure, handed up (ESCALATE) before the fragment settles, the nearest Errored whose markup is out asks the renderer where the page has it (`ShellContainer.locate`): the two ends of its node range, each named by what it already carries, a hydration key or a Loading placeholder, with the end of the content that has since replaced a placeholder as a further candidate (recorded as each fragment's content is sent). With both ends named, it renders its fallback as the before-shell path does (`drawInShell`: finished as it renders, or not at all; nothing waits) and the renderer sends it in a template keyed by the Errored id, the error staged at `<id>_ef`, its head registrations parked at the id, and `$dfx(id, first, last, 1)`. `$dfx` (sent once, with the first such fallback) puts the fallback in place of the range only while no client runtime has started (`_$HY.f` unset), with both ends found and the last reachable from the first by nextSibling, and in the same step moves the record to the Errored id: a client finds the fallback and its record together or neither. Otherwise it changes nothing, and the client renders the failure from the rejected channel, as before. It wraps `$dfr` so a fragment of a replaced region that settles later drops its template instead of queueing for a placeholder that is gone. The failed fragment settles as before, and nothing in the region is released: a page that does not take the fallback is the 5ef1abd page. The nearest Errored owns the failure and never passes it up, except when its own fallback fails (solidjs#4316). An Errored inside a region whose fallback already went out declines. The hook hears `fallback` when the fallback is sent, `client` otherwise. Not sent (the client renders the failure, as before): an end with neither a key nor a placeholder (text, NoHydration content, hand-written ssr() with no key), `<html>`/`<head>`/`<body>` as the content's or the fallback's root, a fallback not finished as it renders, a transport sink, noScripts, a server component. No client runtime change. A render without such a failure is byte-identical (every recorded harness artifact but the three nested after-shell failures is unchanged). Tests: test/server/ssr-errored-nested-postflush-5223.spec.tsx parses each stream with jsdom, scripts on, so the parser is part of every assertion: the original shapes, and every repro of the two reviews of the first attempt (tables, document-level and body-level Errored, the never-settling and overtaking fallbacks, the direct-shape inner Errored, a later failure in a replaced region, Reveal groups, head tags, NoHydration, the record, the hook, authored pl-* markup, the shell race). Harness shapes recorded by hydration-harness.spec.tsx and replayed by test/hydration/errored-nested-postflush-5223.spec.tsx (adopted after the stream; rendered by the client from the shell; a later root on a page whose runtime had started) and test/hydration/errored-nested-postflush-review-5223.spec.tsx (the reviews' H1-H6 in three arrival orders). The frame-outcome test that pinned the blank now pins the fallback sent beside it. 12-ssr-http.md: the `client` handling note covers the after-shell case. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
During
renderToStream, when an<Errored>contains a<Loading>whose async read fails before the shell is sent, and that<Loading>is not the<Errored>'s only content (markup between them, or siblings), the server sends a blank where the error fallback should be. The fallback appears only once the client hydrates, and never without JavaScript.<main><b></b></main><main><p>failed: no user</p></main><Errored><Loading>(direct shape, main and this PR)<main><p>failed: no user</p></main>Why this is a leftover of #4303
#4303 (fixing #4287) describes this blank as the bug: "Until hydration the browser showed neither the loading fallback nor the error fallback." It then draws the fallback only when the
<Loading>is the whole content of the<Errored>, and keeps the blank otherwise: "With markup between the two boundaries (<Errored><section><Loading>), the position stays blank and the client renders the failure, as before." Its review notes say the same: "The fallback is drawn only for the direct shape; nested markup stays blank."Before the shell is sent, nothing has gone out yet, so the fallback can go straight into the shell.
The fix
While the renderer still holds the shell, the shell is a region container (
ctx.shell), as a pending<Loading>fragment already is since #4316. The failing<Loading>hands the failure up (ESCALATE), and the nearest enclosing<Errored>whose finished markup is in the shell replaces that markup with its fallback. The error is serialized at the<Errored>id, so the hydrating client adopts the markup without asking again and recovers when the content's inputs change, as for the direct shape.The scope is deliberately conservative:
<Errored>above it, is not drawn: the output is exactly main's, and the client renders the failure.<Errored>emits no markers, so its markup is found by its text in the held shell (fragments inlined since it rendered are replayed on it). It is replaced only when it carries a hydration key or a<Loading>placeholder and occurs exactly once. An<Errored>that put nothing, or text alone, into the page, or that was never inserted, is left as on main, and so is any<Errored>around it.What the replaced content left pending goes with it: its pending
<Loading>s and serialized values are released, so nothing streams for content the page no longer has.Public API changes
No export, option or signature changes. Two documented behaviours change, both only for the shape above (nested
<Loading>, failure before the shell, fallback drawn):handling: the hook hearsfallbackinstead ofclient, as fix(solid): an Errored around a failing streamed Loading draws its fallback on the server #4303 did for the direct shape. When the fallback is not drawn, it hearsclientas before.useHeadtags of the replaced content never reach the document head (a client render that shows the fallback never ran that content). The fallback's own tags are kept.Internal only:
HydrationContextgains an@internalshellfield, and head registrations record the registering owner's id.Behaviour changes to review
<Errored>around the group now draws its fallback in place of both slots, so the scenario they test no longer happens there. They now reject fromonCompleteShell. The pre-shell case is pinned separately, both drawn (fallback in place of the group, nothing streams for the other slot) and not drawn (a client-only hole in the fallback: the sibling still streams and activates).fallbackonly once the fallback is known to be drawable. If the hook then maps the error to another value and the fallback read the error, the fallback renders a second time with the mapped value, at the same ids.<Loading>failing inside content the fallback already replaced, or a<Loading>inside one that already failed) are reported to the hook asclient, as on main.documentation/solid-2.0/12-ssr-http.md: one sentence added to theclienthandling note, covering the nested pre-shell case.Known limits
fallback. The client still renders the failure. Pinned by a test.<Loading>from the first render is not rendered again, that<Loading>'s fragment still settles and streams an empty template with no placeholder to fill. It is inert.How did you test this change?
New and changed tests:
packages/web/test/server/ssr-errored-nested-preflush-4287.spec.tsx(22 tests): the awaited form, an<Errored>inside a<Loading>settled into the shell, a sibling<Loading>settled inside a pending one, a failing fallback with and without an outer<Errored>, hook mapping (drawn; a<Loading>in the fallback keeps its fragment and serialized value; second render throwing), fallbacks that are async, never settle or have a client-only hole (shell not delayed, hook hearsclient), markup with no place of its own (empty, text alone with the same text earlier in the page, an<Errored>that was not inserted), failures nothing draws for still reported, a thrown non-object, and head tags.element,sibling,settled-sibling,pending-sibling) recorded byhydration-harness.spec.tsxand replayed bytest/hydration/errored-nested-preflush-4287.spec.tsx, hydrated after the stream and from the shell: the server's fallback node is adopted, nothing is asked again, and the boundary recovers when the input changes.ssr-stream.spec.tsx: the two moved 2.0.0-beta.14: Rejected async boundary inside <Reveal> stalls sibling reveal during SSR streaming #2776 tests and four pre-shell Reveal variants.Results, this branch against main (50a4bfd), same machine:
packages/webvitest run --config vite.config.server.mjspackages/webvitest run --config vite.config.hydrate.mjspackages/solidvitest run test/serverAlso run, all clean:
tscforpackages/solid(tsconfig.test.json,tsconfig.no-dom.json,tsconfig.build.json) andpackages/web(tsconfig.build.json,tsconfig.test.json,tsconfig.test.augment.json,tsconfig.test.libcheck.json);prettier --checkon the changed files;node packages/signals/scripts/rules-index.mjs --check.The built production server bundles (
dist/server.js) were checked with the hand-written repro from the summary:<main><p>failed: Internal Server Error</p></main>for the nested shape before the shell (the generic production wire value), the original message withmarkSafeError, and the mapped value with a hook.Size
scripts/size(node size.mjs --no-gate), built from this branch and from main:server: renderToString (the server-render floor): 23588 B to 23596 B brotli (+8 B), 80403 B to 80442 B minified (+39 B), under its 23.62 KB cap.signals: + until/refresh,page: base server components,page: live server components); this PR does not touch them.Part of #5223 (the before-shell case). Refs #4287, #4303
🤖 Generated with Claude Code