fix: prepend the server-component bootstrap to the hydration script - #294
fix: prepend the server-component bootstrap to the hydration script#294brenelz wants to merge 1 commit into
Conversation
The generated-entry handler injected the placeholder registry as its own `<script>` right after the opening `<head>` tag. That anchor is correct for ordering — the render plugin serializes placeholders as `self._$SC.r(id)`, so the registry has to exist before the hydration data script runs — but the extra node becomes an unexpected first child of `<head>`, and Solid's structural hydration cursor walks that. Prepend the bootstrap to the hydration runtime script instead: it still runs before any hydration data, and the document's head structure is unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: da24711 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
|
Superseded by a runtime-level fix. As of @dom-expressions/runtime 0.50.0-next.37, serialized server-component references self-bootstrap the |
Problem
With
serverFunctions.componentson a generated entry, hydration reports every client component that sits in a server-component slot as unclaimed server markup:Cause
ssrServeinjects the placeholder registry as its own<script>immediately after the opening<head>tag. The ordering that anchor buys is real — the render plugin serializes placeholders asself._$SC.r(id), so the registry must be defined before the hydration data script runs, and anchoring on</head>lands after<HydrationScript />— but the injected node becomes an unexpected first child of<head>, which Solid's structural hydration cursor walks.Fix
Prepend the bootstrap source to the hydration runtime script that is already in the document, instead of adding a script node. Same ordering guarantee, no extra node.
The turnkey frames check is updated to assert the new placement: the bootstrap and
window._$HYmust live in the same<script>, with the bootstrap first and still ahead of any_$HY.r[data.🤖 Generated with Claude Code