Skip to content

fix(ssr): strip the shell-end marker from client-mode shells - #413

Merged
ryansolid merged 1 commit into
nextfrom
claude/project-thread-xvubyg
Oct 13, 2026
Merged

ryansolid merged 1 commit into
nextfrom
claude/project-thread-xvubyg

Conversation

@ryansolid

Copy link
Copy Markdown
Member

Requested by Ryan · project thread

Before: with @solidjs/web 2.0.0-rc.15, a client-mode (start: true, no ssr) shell whose Document carries <HydrationScript /> keeps <script>_$HY.s[""]=1,_$HY.sw&&_$HY.sw("")</script>. The plugin has already stripped the bootstrap that defines _$HY, so the browser throws _$HY is not defined. This happens in dev and in the prerendered dist/client/index.html. In examples/start-client, [dev/shell] no hydration script (_$HY stripped from Document) fails.

After: the client-mode chunk transform strips the marker together with the bootstrap, so no _$HY is left in the shell.

The marker is new in solidjs/solid#4002, which is in the rc.15 release. SSR mode is unaffected, and so are shells from rc.14 and earlier, which have no marker.

How: the client-mode transform gets one extra replace. It matches <script…>_$HY.s[ up to </script> and runs in any chunk, because the marker follows the shell's records rather than its head. The render id is JSON with < escaped, so the lazy match can't end early. There is also a patch changeset.

Testing:

  • Against @solidjs/web/solid-js packed from solid next (eae6e03): start-client goes from 1 failing assertion to 70/70. ssr, css-matrix and start-env all pass.
  • start-ssr: 742/749 against next. The 7 failures are the async-mode "complete document (… </html> in one piece)" checks. On the solid side, the marker is appended after </html> in a fully assembled document. That isn't a plugin issue, and this PR doesn't change it.
  • Against the published rc.14: start-client 70/70 and start-ssr 749/749. tsc --noEmit is clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01R2FCNsvaipU3xXx9p83VUs


Generated by Claude Code

@solidjs/web 2.0.0-rc.15 (solidjs/solid#4002) ends every shell that
rendered <HydrationScript /> with an unguarded `_$HY.s[id]=1` script.
Client mode already strips the HydrationScript bootstrap from a Document
shared with SSR mode, so the marker was left behind and threw
`_$HY is not defined`. Strip it with the bootstrap.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R2FCNsvaipU3xXx9p83VUs
@ryansolid ryansolid self-assigned this Oct 13, 2026
@changeset-bot

changeset-bot Bot commented Oct 13, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: eb47535

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@solidjs/vite-plugin Patch

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

@pkg-pr-new

pkg-pr-new Bot commented Oct 13, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@solidjs/vite-plugin@413

commit: eb47535

@ryansolid
ryansolid merged commit 3d21829 into next Oct 13, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants