Skip to content

fix(octane): give a server descriptor list item with a portal child its item range - #2081

Merged
trueadm merged 1 commit into
nextfrom
fix/next-portal-item-range
Oct 15, 2026
Merged

trueadm merged 1 commit into
nextfrom
fix/next-portal-item-range

Conversation

@trueadm

@trueadm trueadm commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • A server-rendered descriptor list item that is a host with a portal child now gets the item range the hydrating client expects.

Why

  • Follow-up to perf(octane): render computes, commit writes — runtime size redesign (#2043) #2044 (Cursor Bugbot thread 4270914753). serverDescNeedsBlocks in runtime.server.ts did not treat PORTAL_TAG as needing a block, while the client's descNeedsBlocks does. A <li>{createPortal(...)}</li> item in a descriptor list was routed through the plain descriptor path, which rejects a portal (Objects are not valid as an Octane child), instead of the block path that emits the range hydration reads.

Changes

  • serverDescNeedsBlocks returns true for a portal descriptor, matching the client predicate.
  • descriptor-list-hydrate.test.ts: new PortalDescriptorRows fixture and test. It server-renders host items whose only child is a portal, hydrates them, asserts no recoverable error, row identity, portaled content in the target, and a keyed reorder. It failed before the fix (server render threw) in both the octane and octane-prod projects.
  • The unreleased hydration-descriptor-list-items changeset now says "no component or portal inside it".

The other #2044 Bugbot thread (4269852570, "Switch arms lose binding-view ranges") needs no code change. dom-binding-program.js's annotate sets _octaneBindingSite only on non-native elements, @if/IfStatement (including JSX ternaries via conditionalJsxStatement), @for and @try. It never sets it on SwitchStatement or JSXSwitchExpression, and ssrEmitSwitch reads no binding site, so a @switch is never a binding view.

Validation

  • pnpm format:files:check (changed files)
  • pnpm typecheck:files (changed files)
  • pnpm test: not run in full locally; CI runs it
  • targeted tests: descriptor-list-hydrate.test.ts (34 passed), packages/octane/tests/{hydration,server,ssr} (17,882 passed), packages/octane/tests/conformance (5,562 passed), packages/octane/tests/*portal* (178 passed)
  • perf-review: node scripts/perf-review-scan.mjs --base origin/next reports no candidates. The change adds one property compare at the end of a server-only predicate, on the path a descriptor already falls through.
  • concise-code: one-line predicate change that mirrors the client. I rejected handling a portal in ssrDeoptItemContent instead, because it would split the routing decision from the predicate that selfDelimits reads.

Risk / follow-ups

  • A host item with a portal anywhere below it now takes the block path on the server, as it already did on the client.

Provenance

  • An agent produced this diff (agent-authored)

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Note

Medium Risk
Touches SSR/hydration routing for descriptor lists; scope is narrow (one predicate) but mismatches here cause client recovery or render failures.

Overview
Server descriptor-list serialization now treats portal children like the client hydration path, so a host list item whose only child is createPortal(...) gets the comment item range the client expects instead of the plain descriptor path (which could fail or mismatch).

serverDescNeedsBlocks in runtime.server.ts now returns true for PORTAL_TAG, mirroring client descNeedsBlocks. The hydration changeset text is updated to say self-delimiting items exclude portals as well as components. A new PortalDescriptorRows hydration test covers SSR, hydrate without recoverable errors, portaled content, and keyed reorder.

Reviewed by Cursor Bugbot for commit a077920. Bugbot is set up for automated code reviews on this repo. Configure here.

…ts item range (#2028)

serverDescNeedsBlocks did not count a portal as needing a block, while the
client's descNeedsBlocks does. A host item whose child is a portal was then
serialized through the plain descriptor path, which rejects a portal, instead
of the block path whose range hydration expects. A portal now needs a block on
the server as on the client.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@trueadm
trueadm marked this pull request as ready for review October 15, 2026 12:15
@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix labels Oct 15, 2026
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
octane-website a077920 Commit Preview URL

Branch Preview URL
Oct 15 2026, 12:18 PM

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
octane-website-mcp a077920 Commit Preview URL

Branch Preview URL
Oct 15 2026, 12:17 PM

@trueadm
trueadm merged commit 98ce9c3 into next Oct 15, 2026
46 of 53 checks passed
@trueadm
trueadm deleted the fix/next-portal-item-range branch October 15, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant