Repository navigation
SSR: render member/dynamic tags resolving to host tag strings - #18
Merged
Merged
Conversation
A member-expression or dynamic JSX tag (<obj.tag/>, <{expr}/>) whose
runtime value is a host tag STRING (e.g. MDX's _components.h1 mapping,
unoverridden) rendered fine on the client — value-lowered to a
createElement descriptor the de-opt renderer accepts — but crashed SSR:
the server lowering emits ssrComponent(__s, obj.tag, …), which CALLED
the string ("comp is not a function").
ssrComponent now routes a string comp to ssrHostElement inside the same
single <!--[-->…<!--]--> block a component body gets (ssrChild's
host-descriptor shape), so hydration adopts one uniform range whichever
kind the tag resolves to. Dispatch stays dynamic (a function override
still renders as a component) and injection-unsafe tag strings still
throw, matching the client where document.createElement rejects them.
With the gap closed, drop @octanejs/mdx's SERVER-mode workaround that
wrapped _components.* elements in expression containers to force the
ssrChild value-hole path (recmaOctaneAdapter adaptation 3).
Co-Authored-By: Claude Fable 5 <[email protected]>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 95b8c03. Configure here.
Review follow-up (Bugbot): a template (@{}) call site compiles a
member/dynamic tag's children to a __schildren$N render fn in
props.children. The string branch passed it into ssrHostElement, whose
descriptor-content path rendered it as a nested COMPONENT body —
wrong calling convention (fresh scope/frame instead of the
ssrChildrenHtml/ProviderBody `(undefined, scope)` convention) and a
stray <!--[-->…<!--]--> around the element's content versus the
value-position / client de-opt shape.
ssrComponent's string branch now calls a function-valued children
directly and inlines its HTML as the element's plain content (holes
inside keep their own blocks, exactly like a static host tag). A
non-compiled fn (a render-prop child) returns a descriptor, not HTML —
normalized via ssrChild, mirroring renderComponentFramed's de-opt
return handling.
Co-Authored-By: Claude Fable 5 <[email protected]>
…-99e802 # Conflicts: # packages/mdx/src/compile.ts # packages/octane/src/runtime.server.ts # packages/octane/tests/hydration/_fixtures/host-string-tag.tsrx # packages/octane/tests/hydration/host-string-tag-hydrate.test.ts # packages/octane/tests/ssr-host-string-tags.test.ts
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
…licts Both conflicts were doc text where this branch's Phase-1 version supersedes main's intermediate one; kept ours and grafted in main's test-file citations for gaps 1 and 2. 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.

A member-expression or dynamic JSX tag (<obj.tag/>, <{expr}/>) whose runtime value is a host tag STRING (e.g. MDX's _components.h1 mapping, unoverridden) rendered fine on the client — value-lowered to a createElement descriptor the de-opt renderer accepts — but crashed SSR: the server lowering emits ssrComponent(__s, obj.tag, …), which CALLED the string ("comp is not a function").
ssrComponent now routes a string comp to ssrHostElement inside the same single … block a component body gets (ssrChild's host-descriptor shape), so hydration adopts one uniform range whichever kind the tag resolves to. Dispatch stays dynamic (a function override still renders as a component) and injection-unsafe tag strings still throw, matching the client where document.createElement rejects them.
With the gap closed, drop @octanejs/mdx's SERVER-mode workaround that wrapped _components.* elements in expression containers to force the ssrChild value-hole path (recmaOctaneAdapter adaptation 3).
Note
Medium Risk
Touches MDX compile output and SSR/hydration paths for dynamic tags; behavior change is intentional but affects all server-compiled MDX markdown elements.
Overview
With octane now rendering member/dynamic tags that resolve to host tag strings on SSR (and hydrating them),
@octanejs/mdx'srecmaOctaneAdapteris trimmed to a single fix: rewriting bare_createMdxContent(props)calls to<_createMdxContent {...props}/>for the component ABI.Removed server-only ESTree hacks that wrapped
<_components.*>in expression containers and the earlier_createMdxContentrename; docs now mark those octane gaps as fixed.Added octane tests for the MDX-shaped value-position case (
<_components.h1>-style member tags in.tsxreturns): SSR static/string output, runtime string-vs-component dispatch, andhydrateRootparity forDoc/Overridablefixtures.Reviewed by Cursor Bugbot for commit 4620dc2. Bugbot is set up for automated code reviews on this repo. Configure here.