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 73c288c
Browse filesBrowse the repository at this point in the historyBrowse files
Non-hydratable client builds now remove the `value` attribute when a checkbox or radio input binds a nullish `value` or `defaultValue`, matching the runtime fix from #4009, so a checked box submits `"on"` instead of `""`. Both compilers route these bindings through `setProperty` when the input's static `type` is `checkbox` or `radio`, or when its `type` cannot be known at compile time (an expression, `prop:type`, `attr:type`). Text inputs, inputs without a `type`, and textareas still clear to `""` inline (#2957).
`onHydrationEnd` is public API again, as `@experimental` (#4000), so end-to-end tests have a documented end-of-hydration signal instead of reading `_$HY` internals. It was already a runtime export of both entries; only its declarations change (it is no longer stripped as `@internal`), so it adds no runtime bytes. `sharedConfig` and `isHydrationInProgress` stay internal.
6
+
7
+
-`onHydrationEnd(callback)` (`solid-js`): runs `callback` once when the hydration phase ends — the root pass of `hydrate()` over and every streamed `<Loading>` boundary (and every hold an integration registers) resumed or cancelled. With no hydration in progress, and on the server, it runs in the next microtask.
8
+
- Register it after calling `hydrate()`: registered before hydration starts (or after a `hydrate()` parked mid-parse, #3971), it runs in the next microtask and does not wait for hydration work started afterward.
9
+
- It reports that the phase ended, not that hydration succeeded: a document root whose module preload fails ends the phase with the server markup kept and not interactive.
10
+
- It is not page-wide completion with several hydration roots: a root deferred behind its module preload is not counted (GH5).
11
+
- Intended for test tooling and markers, not for branching what the app renders.
12
+
13
+
This reverses the part of the earlier "Remove isHydrating/onHydrationEnd from public API" entry that covered `onHydrationEnd`, as #3718 did for `isHydrating`: hydration snapshots make timing transparent to code inside the app, not to a test reading the page from outside it.
Copy file name to clipboardExpand all lines: documentation/solid-2.0/12-ssr-http.md
+28Lines changed: 28 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,6 +30,34 @@ For hydration, the document needs the hydration script ahead of the app markup:
30
30
31
31
In a hand-built document the render output ends with the serialized hydration records (`_$HY.r`), written by a classic inline `<script>`. The client entry must execute after that script: make it a deferred `<script type="module">` (or a `defer` classic script), or place it after the render output — never `async`, which may run before the records have been parsed and hydrate against an empty document. `<HydrationScript />` documents handle the ordering themselves: the records script is spliced immediately after the bootstrap, so the entry may be `async` there.
32
32
33
+
### Observing the end of hydration: `onHydrationEnd` (experimental)
34
+
35
+
`onHydrationEnd(callback)` (`solid-js`, `@experimental`) runs `callback` once, when the hydration phase ends: the root pass of `hydrate()` is over and every streamed `<Loading>` boundary — and every hold an integration registers, such as server-component content waiting for its data — has resumed or been cancelled. When no hydration is in progress (before `hydrate()` starts, after the phase has ended, in a client-only render, on the server) it runs in the next microtask.
36
+
37
+
It exists for test tooling and markers: an end-to-end test that must wait until the client has taken over before it checks state the client writes, or must assert that it has not yet. It is not a way to branch what the app renders — read `isHydrating()` where a value must match the server and switch to the client-only value from `onSettled` (RFC 01).
-**Register it after calling `hydrate()`.** Registered before hydration starts, the callback runs in the next microtask and does not wait for hydration work started afterward. The same holds when `hydrate()` parks because the entry ran while the parser was still inside the server shell (an `async` entry, #3971): hydration starts at the shell-end marker, after `hydrate()` has returned.
58
+
-**It reports that the phase ended, not that hydration succeeded.** When a document root's module preload fails, `hydrate()` abandons hydration and keeps the server markup, which is not interactive; the callback still runs. A non-document root whose preload fails runs it before falling back to a client render. Check the expected behavior (and the reported error) separately.
59
+
-**It is not page-wide completion with several hydration roots.** A root whose render waits on its module preload is not counted, so another root finishing ends the phase before that root has claimed anything (GH5 in `documentation/server-components/frames-consistency-contract.md`).
60
+
33
61
### Consuming the stream: `pipe`, `pipeTo`, `readable`
34
62
35
63
`renderToStream` returns a result with three consumption surfaces — **exactly one may be used per render** (a second consumer throws with a directed message):
0 commit comments