Skip to content

Compose HTML EAP: Support multiple hydration roots for island hydration - #5737

Merged
Clemens Koprolin (clemenskoprolin) merged 5 commits into
masterfrom
clemenskoprolin/compose-html-multiple-hydration-roots
Sep 30, 2026
Merged

Clemens Koprolin (clemenskoprolin) merged 5 commits into
masterfrom
clemenskoprolin/compose-html-multiple-hydration-roots

Conversation

@clemenskoprolin

Copy link
Copy Markdown
Collaborator

This PR lets a server-rendered document contain multiple independently hydrated Compose HTML regions. HydrationRoot accepts an optional hydrationId and writes it to the root and its state element. hydrateRoot uses that ID to find the matching pair. Existing unnamed roots keep their behavior.

Hydration fails before deserializing state or changing the DOM when a named pair is missing or duplicated. Strict server-side validation also rejects duplicate hydration IDs.

Adds a hydration islands example and JVM, JS and Wasm tests for named roots and invalid pairs.

Fixes CMP-10871

Testing

Run from the html directory:

./gradlew -Pcompose.html.eap.enabled=true \
  :html-core-eap:jvmTest \
  :html-core-eap:jsBrowserTest \
  :html-core-eap:wasmJsBrowserTest \
  :html-eap-hydration-islands-example:jsBrowserDevelopmentWebpack \
  :html-eap-hydration-islands-example:wasmJsBrowserDevelopmentWebpack

Release Notes

N/A

@clemenskoprolin
Clemens Koprolin (clemenskoprolin) merged commit e08899e into master Sep 30, 2026
2 checks passed
@clemenskoprolin
Clemens Koprolin (clemenskoprolin) deleted the clemenskoprolin/compose-html-multiple-hydration-roots branch September 30, 2026 13:14
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