Repository navigation
Render dynamic host-tag strings through componentSlot (client + SSR +… - #19
Merged
Merged
Conversation
… hydration)
A template-position JSX tag that resolves to a host tag STRING at runtime
(<props.parts.title> with { parts: { title: 'h1' } }, <Tag/> with
const Tag = 'h1') lowers to componentSlot, which created a 'dynamic' block
whose body was the string — renderBlock's block.body(...) then threw
"not a function" on both fresh mounts and hydration. The server's
ssrComponent likewise tried to invoke the string.
Client: componentSlot now routes a string comp through the existing de-opt
host renderer — body = hostElementBody, props = a host ElementDescriptor
carrying the tag + props + the compiled children render-fn — so prop
diffing, delegated events, commit-phase refs, and hydration adoption all
come from the proven machinery. Identity still compares the raw string:
same tag patches the element in place; a tag change or string<->function
flip tears down and remounts (React's element-type reset). The transition
off-screen (WIP) paths are rerouted too so they can't invoke the string.
Server: ssrComponent serializes a string comp as
<!--[--><tag>...children block...</tag><!--]--> via ssrBlock(ssrHostElement),
the exact shape the client's componentSlot + hostElementBody adopt on
hydration (VALID_TAG_NAME still rejects injection-unsafe tags).
Tests: client mount/update/hydration (hydration/host-string-tag-hydrate),
SSR shapes (ssr-host-string-tags), and a differential fixture proving
byte-equal HTML vs real React across mount, in-place bumps, and tag flips.
Co-Authored-By: Claude Fable 5 <[email protected]>
trueadm
added a commit
that referenced
this pull request
Jul 6, 2026
Merges origin/claude/serene-lehmann-99e802 (PR #18): ssrComponent's string branch now inlines a template call site's __schildren$N render-fn output as the element's PLAIN content (rawInner in ssrHostElement) — one outer <!--[-->…<!--]--> block around the element, no nested block around its content — per review feedback on #18 flagging the nested-block shape (which main got via #19) as a bug. Also brings #18's MDX cleanup: the server-mode _components.* value-hole workaround is dropped now that the runtime handles string tags natively (merge keeps main's #17 _createMdxContent handling). Client reworked to match: componentSlot's string branch renders through a new hostStringTagBody instead of hostElementBody. The element part is the same de-opt machinery (adopt/create/patch, refs, delegated events, mismatch recovery), but the compiled children render-fn now renders through ONE self-bounding Block whose range is all of the element's content — parentNode = el, no comment markers — so client mounts emit no inner markers and hydration adopts the server content directly off el.firstChild. A render prop returning a descriptor still routes through renderBlock's return-slot (childSlot, block-wrapped), mirroring the server's ssrChild normalization. Value-position function children (createElement) keep the marker-wrapped hostElementBody/childSlot path — the server block-wraps those. Tests unified from both branches: #18's value-position SSR/hydration suite + this branch's template-position mount/update/hydration suite, all pinned to the inline shape, plus new template-position SSR pins (component child stays block-wrapped inside inline content; void; event/ref filtering). Co-Authored-By: Claude Fable 5 <[email protected]>
trueadm
added a commit
that referenced
this pull request
Jul 6, 2026
Main's #18 squash resolved its conflicts against #19 by keeping the old nested-children server shape (5e36971's inline revision was dropped in the resolution — the squash touches only mdx/docs/tests, no runtime). This branch deliberately keeps the review-approved INLINE shape on both sides (server rawInner + client hostStringTagBody) and re-pins the merged tests to it; main's duplicated value-position suite and fixture section from the squash's own unification are deduped against this branch's versions. Co-Authored-By: Claude Fable 5 <[email protected]>
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.
… hydration)
A template-position JSX tag that resolves to a host tag STRING at runtime (<props.parts.title> with { parts: { title: 'h1' } }, with const Tag = 'h1') lowers to componentSlot, which created a 'dynamic' block whose body was the string — renderBlock's block.body(...) then threw "not a function" on both fresh mounts and hydration. The server's ssrComponent likewise tried to invoke the string.
Client: componentSlot now routes a string comp through the existing de-opt host renderer — body = hostElementBody, props = a host ElementDescriptor carrying the tag + props + the compiled children render-fn — so prop diffing, delegated events, commit-phase refs, and hydration adoption all come from the proven machinery. Identity still compares the raw string: same tag patches the element in place; a tag change or string<->function flip tears down and remounts (React's element-type reset). The transition off-screen (WIP) paths are rerouted too so they can't invoke the string.
Server: ssrComponent serializes a string comp as
...children block... via ssrBlock(ssrHostElement), the exact shape the client's componentSlot + hostElementBody adopt on hydration (VALID_TAG_NAME still rejects injection-unsafe tags).Tests: client mount/update/hydration (hydration/host-string-tag-hydrate), SSR shapes (ssr-host-string-tags), and a differential fixture proving byte-equal HTML vs real React across mount, in-place bumps, and tag flips.
Note
Medium Risk
Touches core
componentSlotandssrComponentreconciliation/hydration paths, but the change is a narrow branch for string comps reusing existing host machinery; value-position behavior is unchanged.Overview
Template-position JSX whose tag is a runtime host string (
<Tag/>withTag = 'h1',<props.parts.title>, etc.) no longer crashes:componentSlot/ssrComponentused to treat the tag string as a component body and fail with "not a function".Client: When
compis a string,componentSlotroutes through the existing de-opt host path (hostElementBody+ anElementDescriptor), including WIP/off-screen transition renders. Slot identity still uses the raw tag string—same tag patches in place; tag change or string ↔ component remounts like React.Server:
ssrComponentserializes string comps as<!--[--><tag>…children…</tag><!--]-->viassrHostElement, matching what hydration adopts.Tests: Hydration, SSR markup, and React differential coverage for mount, updates, tag flips, refs/events, and nested component children.
Reviewed by Cursor Bugbot for commit d44629a. Bugbot is set up for automated code reviews on this repo. Configure here.