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 b6a90f9
Browse filesBrowse the repository at this point in the historyBrowse files
fix(ssr): lazy() module loads hold the shell; dynamic() gains deferStream (#3299)
A lazy module load is code, not data: the shell's "no new async discovered
during the sync render" rule cannot be evaluated for a segment whose code
has not run, so a deferStream read inside a code-split route was created
after the shell shipped and silently ignored. lazy() now blocks the shell
on its module promise (and asset registration) even under a boundary, while
still suspending into that boundary so the data the loaded code discovers
streams as before. Only the first render per process to reach an
un-preloaded chunk pays; a lazy mounted post-shell streams.
The flush loop also re-awaits blockers registered while a boundary resumed
during the drain: allSettled now reports the size it awaited and doShell /
the thenable gate compare against that snapshot, closing the microtask gap
where a warm import's deferStream landed after the check but before the
attempt.
dynamic() keeps streaming its source by default and gains { deferStream }
to opt in, applied at the instance (dynamic() is routinely hoisted with no
render context). Re-pins the July gating specs to the new contract.
Co-authored-by: Cursor <[email protected]>
Fix `deferStream` being a silent no-op inside a code-split `lazy()` component (#3299). A module load is code, not data: the shell's "no new async discovered during the sync render" rule cannot be evaluated for a segment whose code has not run, so the shell now waits for the chunk even under a `<Loading>` (the boundary still owns the data the loaded code discovers — plain async streams behind the fallback as before, and a `deferStream` read inside the chunk holds the shell exactly like one in an eagerly imported component). Only the first render that reaches an un-preloaded chunk pays; a lazy mounted by a post-shell fragment streams as before.
7
+
8
+
Also closes a gap in the flush loop where a shell blocker registered while a boundary resumed during the drain — after the awaited set had settled but before the flush attempt snapshotted it — was never re-awaited.
9
+
10
+
`dynamic()` keeps streaming its source by default (a source is data of unknown cost) and gains a `deferStream` option to opt into holding the shell on it, with the same meaning as `createMemo`'s.
Copy file name to clipboardExpand all lines: documentation/solid-2.0/03-control-flow.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -169,6 +169,12 @@ The `<Dynamic component={...}>` JSX wrapper from 1.x still exists and is unchang
169
169
170
170
`source` may return a `Promise<Component | string | undefined>`. The factory composes with `Loading` / `Errored` through the normal `NotReadyError` flow — no separate suspense primitive or user-side `await`.
171
171
172
+
Under SSR a pending source streams in behind its boundary by default — a source is data of unknown cost (a server component call, say). Pass `{ deferStream: true }` to hold the document's first flush until it settles, the same option `createMemo` takes ([RFC 05](05-async-data.md)); the client ignores it. This is the one place `dynamic` and `lazy` differ: a `lazy()` module load is code, not data, and always holds the shell — the shell cannot decide it has discovered all async until the segment's code has run — while the boundary still owns whatever async that code then discovers.
- The source evaluation is shared across all mounted instances of the returned component, so using one `dynamic(...)` in many places doesn't duplicate work.
0 commit comments