You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f41c6a4
Browse filesBrowse the repository at this point in the historyBrowse files
fix(ssr): contain post-render and bare-child async rejections in renderToString/renderToStream (#3570, #3569) (#3594)
* fix(solid): observe the server async deferred so a post-render rejection cannot exit the process (#3570)
Every server async flight (memo, store, projection, async generator)
settles an internal deferred from `createDeferredPromise`, and
`settleServerAsync` settles it unconditionally so a serialized flight
lands whatever the node's lifetime. Under `renderToString` there is no
serialization channel (`ctx.async` is unset) and the sync `<Loading>`
path never awaits the NotReadyError's source; a `<NoHydration>` zone or
an unread source has no consumer either. A rejection landing after the
HTML was returned therefore rejected a promise with zero subscribers —
an `unhandledRejection` that took Node down with exit code 1, and no
`<Errored>` could see it because the render was over.
Observe the deferred at creation. Real subscribers still see the
rejection exactly as before (a no-op rejection arm is a separate derived
promise). The other internal promises on the path (`subscribePendingRetry`,
the user promise's `.then(v, e)`, the abandoned duplicate flight, the
iterator close) were already observed.
Co-authored-by: Claude via Cursor <[email protected]>
* fix(ssr): a rejecting direct child of <Loading> no longer hangs or crashes renderToStream (#3569)
Two independent layers, each verified on its own.
Routing (solid-js, `ssrLoadingBoundary.runDiscovery`): a template hole
that throws is routed through `ssrHandleError` to the boundary's own
ErrorContext handler, which — once the fragment is registered — owns the
error: `<key>_fr` rejects and the client re-renders the subtree
(`handling: "client"`, the #2997 verdict). A bare child
(`<Loading>{data()}</Loading>`, or a component whose return IS the read)
threw straight out of `fn()` and bypassed that handler, so
`finalizeError` saw an uncontained error and, pre-flush, failed the whole
request. Bare child ≡ template hole now; an error a hole already routed
(`handledRenderError === err`) propagates as before so an enclosing
Errored renders its fallback once.
Containment (@solidjs/web, `renderToStream`): `failRender → abandon()`
disposed the render (clearing `context.trace`) but completed nothing,
and seroval's `onDone` then ran `doShell()` on the disposed render —
`traceMetaMarkup(undefined)` threw the 'emit' TypeError inside a flush
microtask, `onCompleteAll` was never reached, and the awaited promise
(and a pre-flush `.pipe()`) hung forever. `abandon` now completes the
consumer on a render failure (the awaited promise resolves with the HTML
produced so far — the thenable's documented never-rejects contract —
`pipe()` ends its sink, `pipeTo()`/`readable` close the writable) while a
client disconnect still leaves the sink untouched (`disconnected`), and
`onDone` returns on a dead render.
Co-authored-by: Claude via Cursor <[email protected]>
---------
Co-authored-by: Claude via Cursor <[email protected]>
Fix `renderToString` exiting the process on a late async rejection (#3570). Every server async flight settles an internal deferred; under `renderToString` (no serialization channel, the sync `<Loading>` path never awaits the pending source), in a `<NoHydration>` zone, or for an unread source, nothing observed it, so an async memo/store/projection that rejected after the HTML was returned became an `unhandledRejection`. The deferred is now observed at creation; consumers see exactly what they saw before.
Fix `renderToStream` hanging or throwing `TypeError: Cannot read properties of undefined (reading 'emit')` when an async read that rejects is the direct child of `<Loading>` (#3569).
7
+
8
+
-`solid-js`: a bare child's throw (`<Loading>{data()}</Loading>`, or a component whose return is the read) now routes through the boundary's error handler exactly like a template hole's does — the fragment rejects and the client re-renders the subtree (`handling: "client"`), instead of escalating to a request failure pre-flush.
9
+
-`@solidjs/web`: a render failure (`failRender`) now completes the consumer — the awaited promise resolves with the HTML produced so far, `pipe()` ends its sink, `pipeTo()`/`readable` close the writable — and the serializer's completion no longer assembles a shell on the disposed render.
0 commit comments