Repository navigation
Conversation
The Hydration Loader imported @lit-labs/ssr-client's hydrate support lazily, when the first hydrate:* component resolved. A js client block that imported a server-rendered Lit element, directly or through a dependency, evaluated LitElement first. The element then upgraded without hydration support and rendered a second copy of its template into its declarative shadow root. - The Hydration Loader imports hydrate support statically as its first import. setup() keeps patching an already evaluated LitElement as a fallback. - createComponentHydration exposes the loader as hydrationSupportSpecifier. Pages with server or hydrate:* Registered Components get a module script that imports it ahead of their client code script. - Declare @lit-labs/ssr-client as a dependency. - An end-to-end test builds a Markdown Page whose client script imports a hydrated element and counts template copies in Chrome. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: b48a15b 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 |
On Linux, every browser launch unpacks @sparticuz/chromium to the same temporary path. The hydration order test ran in its own test process, launched Chromium in parallel with RocketBuild.test.js and failed in CI with spawn ETXTBSY. The test moves into RocketBuild.test.js, where browser launches run one after another. It had been moved out because every RocketBuild.build() registered another Markdown import hook, and the second hook rejected Markdown files the first had compiled. build() now registers the hook once per process. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
A
js clientblock that imports a server-rendered Lit element (directly or through a dependency) evaluatedLitElementbefore Lit hydration support. The element then upgraded without hydration support and rendered a second copy of its template into its declarative shadow root.Rocket joined the Page client code and the hydration code into one module script. Static imports evaluate in source order, and the Hydration Loader loaded hydrate support only when the first
hydrate:*component resolved:<head> + <script type="module">import "@rocket/js/hydration/hydrationLoader.js";</script> <script type="module"> import 'some-package'; // client code: evaluates LitElement import {HydrationLoader} from '@rocket/js/hydration/hydrationLoader.js'; … </script>createComponentHydrationexposes the loader asparseComponents.hydrationSupportSpecifier, so the dev server, static build and Netlify live assets each use their own resolvable path.serverorhydrate:*Registered Components get the extra module script. Client code and hydration code keep their order.@lit-labs/ssr-clientis now a declared dependency.RocketBuild.build()registers the Markdown import hook once per process. A second registration rejected Markdown files the first hook had compiled, so a second Markdown build in the same process failed.Evidence
New end-to-end test
src/cli/RocketBuild.test.js›50:✖ 50 … AssertionError: Expected the server-rendered template to hydrate, not render twice — 2 !== 1. Removing either half of the fix (the extra script or the static import) also fails.After:
✔ 50: hydrates server-rendered Lit components that a Page client script imports firstUnit tests cover the script order (
layout-helper.test.js20, 21), which Loading Strategies get the script (loaded-page-module.test.js10) and the Netlify specifier. Lint, Prettier andtscpass, and so do the browser tests (12/12).Merge Danger
Door: two-way
Blast Radius: hydrated Pages
Pages with server-rendered Registered Components load one extra small module script before their client code. Pages that loaded hydration support themselves as a workaround keep working and can drop that import.
🤖 Generated with Claude Code