Skip to content

Add streaming SSR to Compose HTML EAP - #5739

Merged
Clemens Koprolin (clemenskoprolin) merged 2 commits into
masterfrom
clemenskoprolin/compose-html-string-streaming
Oct 5, 2026
Merged

Clemens Koprolin (clemenskoprolin) merged 2 commits into
masterfrom
clemenskoprolin/compose-html-string-streaming

Conversation

@clemenskoprolin

Copy link
Copy Markdown
Collaborator

This PR adds composeHtmlToStream and renderHydratedDocumentToStream to Compose HTML EAP. They emit HTML incrementally while composables execute, producing the same output as the existing string renderers.e.

Both APIs accept a synchronous string callback. JVM overloads accept a Writer and reuse character storage without creating a string for each chunk. The writer is not flushed or closed.

Tags and individual Text calls remain intac and elements requiring content validation are buffered until validation succeeds.

String and streaming renders share keyed compositions and attribute builders. Failed keyed renders are disposed and oversized retained output buffers are trimmed after smaller renders.

Solves CMP-10877

Testing

Run from the html directory:

./gradlew -Pcompose.html.eap.enabled=true \
  :html-core-eap:jvmTest \
  :html-core-eap:jsBrowserTest \
  :html-core-eap:wasmJsBrowserTest

Release Notes

N/A

@clemenskoprolin
Clemens Koprolin (clemenskoprolin) merged commit 6b7b6ad into master Oct 5, 2026
2 checks passed
@clemenskoprolin
Clemens Koprolin (clemenskoprolin) deleted the clemenskoprolin/compose-html-string-streaming branch October 5, 2026 12:35
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