Repository navigation
fix(octane): render a server element entry as its component's root, as hydrateRoot does - #2078
Conversation
…s hydrateRoot does renderToString(<App />), and every other server renderer given an element, rendered the element as a value its root returns (renderEntryValue), which frames the component in a range of its own. hydrateRoot(container, <App />) unwraps an element whose type is a component into the root's body and props, as it does App itself, so the client root has no such range. When App returns a component, a fragment, a Suspense boundary or a template, or renders its children, the server's HTML did not match, and the root rendered on the client with a recoverable error. Each server renderer now reads its entry through renderEntry: a component element renders as that component's root, with the props its descriptor renders it with (descriptorProps, shared with ssrComponentDescriptor), and any other value as before. The two entry forms produce the same HTML, and either hydrates through either hydrateRoot form. root-entry-forms pins every pairing of renderToString and renderToReadableStream, each given App or <App />, with hydrateRoot given App or <App />, for a root that returns host JSX, a template, a component, a fragment, text, null, a Suspense boundary or its children, in dev and prod compiles: 80 of its 256 cases fail before this change. Client bundles are unchanged; the minified server runtime shrinks 234 B raw. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
octane-website-mcp | a0f38ca | Commit Preview URL Branch Preview URL |
Oct 15 2026, 12:00 PM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
octane-website | a0f38ca | Commit Preview URL Branch Preview URL |
Oct 15 2026, 12:02 PM |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Scoped children resolve too early
- Moved the SCOPED_ELEMENT_PROPS.has(d.props) check before the d.children access in descriptorProps so scoped descriptors return d.props without triggering the deferred children getter in the parent scope.
Or push these changes by commenting:
@cursor push 4ba11f9da9
Preview (4ba11f9da9)
diff --git a/packages/octane/src/runtime.server.ts b/packages/octane/src/runtime.server.ts
--- a/packages/octane/src/runtime.server.ts
+++ b/packages/octane/src/runtime.server.ts
@@ -2354,8 +2354,9 @@
// with a distinct non-null children field need a repaired props object.
/** The props a component descriptor renders its component with, its children among them. */
function descriptorProps(d: ElementDescriptor): any {
+ if (SCOPED_ELEMENT_PROPS.has(d.props)) return d.props;
const children = d.children;
- return SCOPED_ELEMENT_PROPS.has(d.props) || children == null || children === d.props?.children
+ return children == null || children === d.props?.children
? d.props
: { ...d.props, children };
}You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit a51aadc. Configure here.
Benchmark report
Compares js-framework: 1k/10k row operationsAll 20 timed operations (20 without a verdict)
All 64 work counters are unchanged. Application bundle size (bytes)No changes across 93 measured values. Public-import reachability bundles (bytes)
117 other measured values are unchanged. |
…d check A scoped component descriptor's children getter resolves deferred children, so reading it first ran them in the parent's scope before the component entered. Co-Authored-By: Claude Opus 5.5 <[email protected]>
* fix(octane): remove a .tsx Provider's children when they become null (#2076) * fix(octane): remove a .tsx Provider's children when they become null * fix(octane): remove CompiledContext children when they become null * fix(octane): keep CompiledContext's emptied dialect so a rolled-back transition can't duplicate its children * test(website): reload the dev /devtools warm-up once before failing Main a9dfdf7 failed the website integration suite: the dev-SSR beforeAll waited 120 s for the TanStack Devtools trigger on /devtools and skipped all 37 dev-SSR tests. The wait came with #2062 and has failed on main and two branches since, while passing locally on every cold warm-up (~3.9 s). The devtools client mounts after hydration from modules a cold dev server may only discover on that first visit, and Vite recovers with a reload a slow runner can miss. Wait 60 s, log what the first attempt saw, reload once, and fail with the page errors if the trigger still never appears. The devtools tests themselves still assert the trigger and panel on fresh loads. Co-Authored-By: Claude Opus 5.5 <[email protected]> * refactor(three): render Canvas as a Strong template (#2080) * fix(octane): seed nothing for a pending snapshot read instead of throwing (#2077) A server module that reads module signals installs the native read collector as it loads, and every later render in the process then collects its reads for the hydration snapshot. A render that read a pending query through snapshot(), such as an automatically streamed query, completed with a read it could not seed and threw "A completed native server read has no serializable ready value". On main 0bb503f, 28 of the 30 early-independent-intent cases throw once that collector exists, while the same page renders in a server that has loaded no such module. A snapshot renders a pending or failed state as it is, without suspending. The client resolves that state itself, or takes a stream's later delivery, so the read now contributes no seed, which is also no invented ready one. A completed value read of an unready source still throws. The signals-hydration case that pinned the throw now asserts that contract: the pending output renders with no hydration snapshot, adopts the same node, and shows the result once the query resolves. The supplemental native DOM smoke case says the same. The new streamed test loads a module-signal page, renders a pending snapshot under streamed signals, hydrates while the client is still pending, and takes the stream's result without a second fetch. Co-authored-by: Claude Opus 5.5 <[email protected]> * fix(octane): render a server element entry as its component's root, as hydrateRoot does (#2078) * fix(octane): render a server element entry as its component's root, as hydrateRoot does renderToString(<App />), and every other server renderer given an element, rendered the element as a value its root returns (renderEntryValue), which frames the component in a range of its own. hydrateRoot(container, <App />) unwraps an element whose type is a component into the root's body and props, as it does App itself, so the client root has no such range. When App returns a component, a fragment, a Suspense boundary or a template, or renders its children, the server's HTML did not match, and the root rendered on the client with a recoverable error. Each server renderer now reads its entry through renderEntry: a component element renders as that component's root, with the props its descriptor renders it with (descriptorProps, shared with ssrComponentDescriptor), and any other value as before. The two entry forms produce the same HTML, and either hydrates through either hydrateRoot form. root-entry-forms pins every pairing of renderToString and renderToReadableStream, each given App or <App />, with hydrateRoot given App or <App />, for a root that returns host JSX, a template, a component, a fragment, text, null, a Suspense boundary or its children, in dev and prod compiles: 80 of its 256 cases fail before this change. Client bundles are unchanged; the minified server runtime shrinks 234 B raw. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(octane): read a server descriptor's children only after the scoped check A scoped component descriptor's children getter resolves deferred children, so reading it first ran them in the parent's scope before the component entered. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]> * test(website): let the generated MDX hot-update test re-write and outwait a slow runner Main 8318702 failed the website integration suite: "hot-updates generated MDX twice while preserving the surrounding interactive page" timed out waiting 20 s for an edit to reach the page. It also failed on perf/runtime-size-redesign; it passes locally every time. Until 1622fa0 the /devtools warm-up flake skipped the whole dev-SSR block, which hid it. Each edit now waits in 15 s rounds, re-writing the file between rounds in case the watcher dropped a write that followed the previous one, for up to 60 s; the test's budget grows to 180 s. The assertions are unchanged: the generated text updates, the sibling counter keeps its state, and no errors. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(octane): keep an emptied Provider's dialect, and refill it through a frontier (#2043) Clearing an emptied CompiledContext at commit dropped its hooks map, so the empty dialect was lost; it is now kept. A refill's reset opens the scope's frontier like a dialect flip, so its incoming body builds off-document. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Olzhas Alexandrov <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: domgan-oai <[email protected]>


Summary
renderToString(<App />),renderToReadableStream(<App />)and the other server entry points (renderToStaticMarkup,renderToPipeableStream,prerender, andprerenderToNodeStreamthroughprerender) now render a component element as that component's root, the wayhydrateRoot(container, <App />)does. Either server entry form now hydrates through eitherhydrateRootform with no recoverable error.Why
renderEntryValue→ssrChild(<App />)), which framesAppin a range of its own.hydrateRoot(container, <App />)unwraps an element whose type is a function into the root's body and props, as it does forAppitself, so the client expectsApp's content with no surrounding range. The two sides disagreed, so hydration discarded the server DOM and client-rendered with a recoverable error.packages/octane/tests/hydration/root-entry-forms.test.ts, fails 80 of 256 cases on main (e8e155514c) across theoctaneandoctane-prodprojects. Every failure is a server element entry whereAppreturns a component, a fragment, a Suspense boundary or a template, or renders its children. In each one, every server<p>/<main>node is replaced on hydration. Every server pairing givenAppitself already passes, as do element entries whose root returns host JSX, text ornull.Changes
packages/octane/src/runtime.server.ts:renderEntry(entry, props, options)mirrors hydrateRoot's rule. A component element renders as that component's root, with the props its descriptor renders it with. A component function passes through unchanged. Any other value (a host element, Fragment, array, primitive ornull) still renders throughrenderEntryValue, with the second argument read as options.descriptorProps(d)is extracted fromssrComponentDescriptor's three branches. It holds the existing scoped-props / omitted-children / legacy-children rule and is shared by both callers.packages/octane/tests/hydration/root-entry-forms.test.ts+_fixtures/root-entry-forms.tsrx: the matrix coversrenderToStringandrenderToReadableStream, each givenAppor<App />, againsthydrateRoot(c, App, props)andhydrateRoot(c, <App />). The roots return host JSX, a template, a component, a fragment, text,null, a Suspense boundary, or their children, all with props, in dev and prod compiles. Each case asserts that every server element stays connected, that there are no recoverable errors, and that no hydrationconsole.errorfires. It asserts behaviour rather than marker text, so it needed no wire-format changes from the perf(octane): render computes, commit writes — runtime size redesign (#2043) #2044 version.docs/ssr.md: a paragraph in therenderToStringsection on the element entry form..changeset/server-element-entry-root.md:octanepatch.Validation
pnpm vitest run --project octane --project octane-prod packages/octane/tests/hydration/root-entry-forms.test.ts: 80 failed / 176 passed of 256 on main (before the fix), then 256 / 256 passed.pnpm vitest run --project octane --project octane-prod packages/octane/tests/hydration/ packages/octane/tests/hydration-ssr-diagnostics.test.ts packages/octane/tests/hydrate-compiler.test.ts packages/octane/tests/ssrplus the 38 conformance files that render on the server (everypackages/octane/tests/conformance/*.test.*that importsoctane/serveror calls a server renderer): 470 files, 20,938 tests passed.pnpm vitest run --project octane --project octane-prod packages/octane/tests/server-renderable-contract.test.ts: 102 passed. It covers host, primitive, array and empty roots throughrenderToString/renderToStaticMarkup/prerender, plus second-argument options for a component element root in all five transports.pnpm vitest run --project website-unit: 31 files, 443 tests passed.examples/harbor,pnpm test:e2e): 4 / 4 passed. Harbor uses<App />on both sides through React'srenderToPipeableStream/hydrateRoot, with Octane islands inside, so it is end-to-end host-integration evidence rather than a direct exercise of Octane's own element entry.pnpm typecheck: passed.pnpm typecheck:fileson the changed source, test and fixture also passed.pnpm format:files:checkon the five changed files: passed.pnpm sync: no generated changes.pnpm format:check(repo-wide): not run; the changed files were checked directly.pnpm test(full): not run locally; left to CI.perf-review: see below.renderToString(<App />)andrenderToString(App, props)produced byte-identical HTML, and so did the tworenderToReadableStreamforms.concise-code: src +38 −54 (runtime +38 −54, all in the server runtimeruntime.server.ts; the clientruntime.tsis untouched). New files: the test and its fixture (the regression), plus the changeset. No new exports. Alternatives: (a) makehydrateRootframe an element entry the way the server does. Rejected: it would change client hydration for everyhydrateRoot(<App />)caller, and it would break theApp-form servers, which already agree with the client. (b) Unwrap the element inline in each of the five entry points. Rejected: that is five copies of the same rule, where onerenderEntryreplaces the five copies already there. Bytes: client bundles unchanged (runtime.tsis untouched). The minified server runtime (esbuild,NODE_ENV=production, packages external) goes from 175,004 to 174,770 B raw (−234 B), and from 58,004 to 58,045 B under gzip -9 (+41 B).Perf review: fix/ssr-element-entry-root (origin/main e8e1555..a51aadc)
Scan:
node scripts/perf-review-scan.mjs→ 0 candidates.Hot paths touched:
ssrComponentDescriptor(per component descriptor rendered on the server, per request). It now callsdescriptorProps, which runs the same checks as before in the same order and returns the originald.propsor the same single spread. That is one small monomorphic call, likely inlined, with no new allocation.renderEntryruns once per server render call, so it is cold. It allocates one 3-element tuple per request.Dismissed candidates: none.
Not checked: server request throughput, because the change adds no per-node work; no SSR bench was run.
Risk / follow-ups
<!--[-->…<!--]-->range, and it now matchesrenderToString(App, props)byte for byte (checked for the eight fixture roots). A consumer that hydratedrenderToString(<App />)output with something other thanhydrateRootofAppor<App />could see a different frame. Within this repo, the tanstack-router, tanstack-start, astro, email and apollo bindings all pass the component form, so they are unaffected.keyis not rendered for a root element. The client uses the root key only to decide whether a laterroot.renderremounts, so it never affects markup, andrenderToString(App, props)has no key either.Suspense,ViewTransition) now also render as the root, again matching the client's unwrap. Fragment and Activity are tag values, not functions, so they keep therenderEntryValuepath.hydration-ssr-diagnostics(a Context provider element entry) passes.Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.Note
Medium Risk
Changes SSR HTML framing for component-element roots (drops extra hydration range), which could affect consumers that relied on the old markup shape; core hydration paths are heavily tested.
Overview
Server render entry points now treat a root component element like
hydrateRoot, sorenderToString(<App {...props} />)(and streaming/static equivalents) produce the same framing asrenderToString(App, props)instead of wrapping the element throughrenderEntryValue.The server runtime adds shared
renderEntryanddescriptorPropshelpers: component-function roots pass through unchanged; component-element roots unwrap to that component and its descriptor props; other roots still use the value-renderer path with the second argument interpreted as options.prerender,renderToString,renderToStaticMarkup,renderToPipeableStream, andrenderToReadableStreamall use this instead of duplicated prelude logic.Docs note React-style element entry; a hydration matrix test covers server/client component vs element entry across root return kinds, plus a scoped-children SSR test when the entry is a scoped element.
Reviewed by Cursor Bugbot for commit a0f38ca. Bugbot is set up for automated code reviews on this repo. Configure here.