Skip to content

fix(runtime): preserve slotted node order - #6927

Merged
johnjenkins merged 2 commits into
stenciljs:mainfrom
wessmeister:fix/hydrate-parent-owned-annotations
Nov 10, 2026
Merged

johnjenkins merged 2 commits into
stenciljs:mainfrom
wessmeister:fix/hydrate-parent-owned-annotations

Conversation

@wessmeister

@wessmeister wessmeister commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

What is the current behavior?

Scoped SSR hydration can move following text before a slotted shadow component when that child is defined before its parent.

Fixes #6926.

What is the new behavior?

Leave the current host's parent-owned c-id for its enclosing component to process. Continue hydrating the host's descendants normally. Child and text order is preserved without requiring a particular custom-element definition order.

Documentation

No public API or setup change.

Does this introduce a breaking change?

  • Yes
  • No

Testing

  • Added default/named-slot regressions for both hydration orders. Both child-first cases fail on main and pass with this change.
  • All 65 runtime suites pass: 687 tests and three snapshots. Production TypeScript compilation, package build, ESLint and formatting pass.
  • Built-package browser checks preserve both definition orders. With the adapter correction below, the shared Next.js reproduction also passes in development (Chromium) and production (Chromium, Firefox and WebKit). Checks cover server/client components, HTML without JavaScript, direct loads, refresh and React updates. Original server nodes remain in place; no hydration warnings or errors were captured.

Other information

The shared reproduction includes a direct Stencil control and instructions for testing the built packages. Its React example also requires the separate server-serialization correction in output-targets #853. The raw Stencil control isolates this runtime defect without React or Next.js.

@johnjenkins
johnjenkins marked this pull request as ready for review November 10, 2026 17:01
@johnjenkins
johnjenkins requested a review from a team as a code owner November 10, 2026 17:01

@johnjenkins johnjenkins left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! ❤️

@johnjenkins
johnjenkins added this pull request to the merge queue Nov 10, 2026
Merged via the queue into stenciljs:main with commit cf53b0d Nov 10, 2026
31 checks passed
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.

bug: scoped SSR hydration reorders children when the child is defined first

2 participants