Repository navigation
fix(ssr): strip the shell-end marker from client-mode shells - #413
Merged
Merged
Conversation
@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
🦋 Changeset detectedLatest commit: eb47535 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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Ryan · project thread
Before: with
@solidjs/web2.0.0-rc.15, a client-mode (start: true, nossr) 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 prerendereddist/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
_$HYis 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:
@solidjs/web/solid-jspacked from solidnext(eae6e03): start-client goes from 1 failing assertion to 70/70. ssr, css-matrix and start-env all pass.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.tsc --noEmitis clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01R2FCNsvaipU3xXx9p83VUs
Generated by Claude Code