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 c59aa65
Browse filesBrowse the repository at this point in the historyBrowse files
fix(solid): hybrid memo/signal handoff waits for the landing and opens no pending window (#3574 shape)
The memo-shaped hybrid takeover in hydrateSignalLike (#2993) —
createMemo(async function*…, { ssrSource: "hybrid" }) and function-form
createSignal — flipped its gate at CREATION: the client generator re-ran
immediately as a fresh flight, ahead of the still-pending server answer,
superseding the server flight (the #3499 shape #3551 fixed for stores)
and reading pending from creation until the client's first yield. Over a
streamed <Loading> that reproduced #3574 exactly: the boundary resuming
to claim its fragment saw a pending source, selected its fallback, and
tried to claim it against the resolved server content —
`Hydration key miss for "210"`, the `_hk=2000` span replaced instead of
claimed, and `shown = ["loading","true:0","loading","true:0","true:10"]`.
The handoff now follows the store's rules 1–5 on the store's helpers:
adoptedAnswerStream lands the pending answer as a one-yield stream whose
second pull flips the gate (rule 1 — the server flight is not superseded
before it lands); the handoff run is wrapFirstYield over the client
generator with the node's `prev` — the adopted answer — as the quiet
value for steps 0 and 1 (rule 5; the duplicate lands as an equal write;
wrapFirstYield gains an optional `quiet` parameter, one helper for both
adapters); a rejected server answer is adopted and transfers authority
without a handoff run (rule 3); a dependency change before the landing
supersedes the answer (rule 4). Sync and promise-shaped hybrid computes
keep their creation flip and adopt-the-serialized-value semantics
unchanged.
Tests: web server→artifact→hydrate pair for the memo-shaped #3574 fixture
(createMemo and createSignal(fn), generator and promise sources, streamed
and loaded), and a solid handoff spec pinning rules 1–5 for both
families (client generator starts counted before/after the landing,
fresh boundary + isPending during the handoff, rejection paths, rule-4
supersession, client-only mount unchanged).
Size: hydrating (no stores) 20,781 -> 20,843 B (+62), cap 20.80 -> 20.85
KB; hydrating + every store family 30,985 -> 31,134 B (+149), cap 31.1
-> 31.15 KB.
Refs #3574#3593#3551#2993
Co-authored-by: Claude via Cursor <[email protected]>
Hybrid memo/signal handoff waits for the server answer to land and opens no pending window. An `ssrSource: "hybrid"` `createMemo` or function-form `createSignal` over an async generator re-ran the client generator at creation — a fresh flight ahead of the still-pending server answer, superseding it and reading pending from creation until the client's first yield — so a streamed `<Loading>` resuming to claim its fragment after the answer landed selected its fallback against resolved server content: a "Hydration key miss" warning and a flash of the fallback over the streamed content (the #3574 failure, on the value-shaped takeover). The handoff now follows the store's rules (#3551, #3593): it waits for the adopted answer to land, lands that answer as the handoff stream's synchronous first step, discards the client's duplicate first yield, adopts a rejected server answer, and is superseded by a dependency change before the landing. The node reads settled through the handoff, and `isPending` is false for it, until the client generator produces something new. Sync and promise-shaped hybrid computes are unchanged.
Copy file name to clipboardExpand all lines: documentation/solid-2.0/05-async-data.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -189,7 +189,7 @@ Because async lives in ordinary computations, SSR/hydration policy is a per-prim
189
189
**`ssrSource`** is the hydration policy: what initial value the client uses, and whether the compute re-runs.
190
190
191
191
-`"server"`_(default)_ — the client uses the serialized server value as its initial state. The compute does **not** re-run for the initial value; the serialized result is authoritative. Choose this when the compute is deterministic from server-available inputs — the common data-fetch case, where it means no duplicate fetch on load.
192
-
-`"hybrid"` — the client seeds from the serialized server value, then re-runs the compute to take over. Choose this for computes that mix server data with client-only signals (window size, user locale). For function-form storesthe takeover is the tail of the initial load, not a refetch: the store reads settled through it — `isPending` is `false`, and a `<Loading>` created in that window shows content — until the re-run produces something new.
192
+
-`"hybrid"` — the client seeds from the serialized server value, then re-runs the compute to take over. Choose this for computes that mix server data with client-only signals (window size, user locale). For function-form stores, and for memos and function-form signals over an async generator, the takeover is the tail of the initial load, not a refetch: it waits for the server answer to land, and the node reads settled through it — `isPending` is `false`, and a `<Loading>` created in that window shows content — until the re-run produces something new.
193
193
-`"client"` — skip the server value entirely. On the server the compute never runs (an owner is still created so hydration ids stay aligned); on the client it is deferred until hydration completes, then runs as if first-mounted. Choose this for client-only state where serialization is meaningless. What the server renders in the compute's place is the author's choice of channel:
194
194
-**Bare (structural)** — with no declaration, the source is a hole the server can never fill. Reads suspend _finally_: the nearest `Loading` boundary flushes its fallback into the HTML and hands the position to the client, which renders the content fresh after hydration. Read outside a `Loading` boundary this is a render error (the stream would otherwise hang), so bare client sources must sit under a boundary.
195
195
-**Declared (`loadingValue` / `seedLoadingValue`, above)** — the server renders the declared first paint instead of suspending; the client serves the same value while hydrating, then runs the compute. `loadingValue: undefined` is a valid declaration — put the `undefined` in the type and branch on it; store-family sources declare `seedLoadingValue: true` (the seed is what the pre-compute window renders).
0 commit comments