Skip to content

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

Draft
wessmeister wants to merge 1 commit into
stenciljs:mainfrom
wessmeister:fix/hydrate-parent-owned-annotations
Draft

wessmeister wants to merge 1 commit 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.

This branch has not been deployed

No deployments
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

1 participant