Skip to content

fix(vapor): hydrate custom element children - #15595

Merged
edison1105 merged 6 commits into
vuejs:minorfrom
lazerg:fix/issue-15593-vapor-hydration
Sep 24, 2026
Merged

edison1105 merged 6 commits into
vuejs:minorfrom
lazerg:fix/issue-15593-vapor-hydration

Conversation

@lazerg

@lazerg lazerg commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

A custom element or a plain <template> goes through createPlainElement. The compiler emits its children as templates of their own and inserts them after the element exists. During hydration those child templates read whatever cursor the enclosing scope left behind instead of the element's own server output, so they adopt the wrong node and throw. Block children (v-if, v-for, components) survive because codegen already gives them setInsertionState.

Template children now carry insertion state too, and template() enters and exits a hydration cursor when it finds one, so it adopts inside the element and hands the enclosing resume point back afterwards. A server-rendered <template> keeps its children in its content fragment, so the lookup checks there as well.

close #15593

@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: dd3e1312-bdb6-4960-868b-3958feb8e6e3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@vue/compiler-core

pnpm add https://pkg.pr.new/@vue/compiler-core@15595
npm i https://pkg.pr.new/@vue/compiler-core@15595
yarn add https://pkg.pr.new/@vue/compiler-core@15595.tgz

@vue/compiler-dom

pnpm add https://pkg.pr.new/@vue/compiler-dom@15595
npm i https://pkg.pr.new/@vue/compiler-dom@15595
yarn add https://pkg.pr.new/@vue/compiler-dom@15595.tgz

@vue/compiler-sfc

pnpm add https://pkg.pr.new/@vue/compiler-sfc@15595
npm i https://pkg.pr.new/@vue/compiler-sfc@15595
yarn add https://pkg.pr.new/@vue/compiler-sfc@15595.tgz

@vue/compiler-ssr

pnpm add https://pkg.pr.new/@vue/compiler-ssr@15595
npm i https://pkg.pr.new/@vue/compiler-ssr@15595
yarn add https://pkg.pr.new/@vue/compiler-ssr@15595.tgz

@vue/compiler-vapor

pnpm add https://pkg.pr.new/@vue/compiler-vapor@15595
npm i https://pkg.pr.new/@vue/compiler-vapor@15595
yarn add https://pkg.pr.new/@vue/compiler-vapor@15595.tgz

@vue/reactivity

pnpm add https://pkg.pr.new/@vue/reactivity@15595
npm i https://pkg.pr.new/@vue/reactivity@15595
yarn add https://pkg.pr.new/@vue/reactivity@15595.tgz

@vue/runtime-core

pnpm add https://pkg.pr.new/@vue/runtime-core@15595
npm i https://pkg.pr.new/@vue/runtime-core@15595
yarn add https://pkg.pr.new/@vue/runtime-core@15595.tgz

@vue/runtime-dom

pnpm add https://pkg.pr.new/@vue/runtime-dom@15595
npm i https://pkg.pr.new/@vue/runtime-dom@15595
yarn add https://pkg.pr.new/@vue/runtime-dom@15595.tgz

@vue/runtime-vapor

pnpm add https://pkg.pr.new/@vue/runtime-vapor@15595
npm i https://pkg.pr.new/@vue/runtime-vapor@15595
yarn add https://pkg.pr.new/@vue/runtime-vapor@15595.tgz

@vue/server-renderer

pnpm add https://pkg.pr.new/@vue/server-renderer@15595
npm i https://pkg.pr.new/@vue/server-renderer@15595
yarn add https://pkg.pr.new/@vue/server-renderer@15595.tgz

@vue/shared

pnpm add https://pkg.pr.new/@vue/shared@15595
npm i https://pkg.pr.new/@vue/shared@15595
yarn add https://pkg.pr.new/@vue/shared@15595.tgz

vue

pnpm add https://pkg.pr.new/vue@15595
npm i https://pkg.pr.new/vue@15595
yarn add https://pkg.pr.new/vue@15595.tgz

@vue/compat

pnpm add https://pkg.pr.new/@vue/compat@15595
npm i https://pkg.pr.new/@vue/compat@15595
yarn add https://pkg.pr.new/@vue/compat@15595.tgz

commit: 2f88626

@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Size Report

Bundles

File Size Gzip Brotli
compiler-dom.global.prod.js 87.2 kB 30.6 kB 26.9 kB
runtime-dom.global.prod.js 116 kB 43.8 kB 39.2 kB
vue.global.prod.js 176 kB 64 kB 57 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 53.1 kB 20.7 kB 18.9 kB
createApp 61.8 kB 23.9 kB 21.7 kB
createApp + vaporInteropPlugin 124 kB 44.8 kB 40.3 kB
createVaporApp 30.9 kB 11.9 kB 10.9 kB
createSSRApp 66.9 kB 25.9 kB 23.6 kB
createVaporSSRApp 37.6 kB (+47 B) 14.3 kB (+30 B) 13.1 kB (+23 B)
defineCustomElement 68.4 kB 25.9 kB 23.5 kB
defineVaporCustomElement 46.3 kB 16.8 kB 15.4 kB
overall 77.4 kB 29.4 kB 26.6 kB

@lazerg lazerg changed the title fix(vapor): hydrate the children of a custom element or plain template fix(vapor): hydrate the children of a custom element or plain template (fix #15593) Sep 21, 2026
@edison1105

Copy link
Copy Markdown
Member

VDOM does not support this literal HTML <template> hydration case either. The SSR <template> nodes we need to handle are Transition appear wrappers, which already have dedicated hydration handling.

This is an edge case with no demonstrated real-world use case. Let's keep this fix focused on custom elements and remove the generic .content fallback and the literal <template> tests.

@edison1105 edison1105 added wait changes scope: vapor related to vapor mode labels Sep 22, 2026
@lazerg

lazerg commented Sep 22, 2026

Copy link
Copy Markdown
Contributor Author

Done in c83d215. I removed the .content fallback and the literal <template> tests.

Two custom element tests remain: one with a single child, one with multiple children plus a following sibling. The second keeps the append-index path covered now that the multi-child template test is gone. Both fail on the base commit.

@edison1105 edison1105 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The previous scope concern is addressed. There is still an initially empty text case missing from the custom-element hydration fix.

@edison1105 edison1105 changed the title fix(vapor): hydrate the children of a custom element or plain template (fix #15593) fix(vapor): hydrate custom element children Sep 24, 2026
@edison1105
edison1105 force-pushed the fix/issue-15593-vapor-hydration branch from bce6cac to 2f88626 Compare September 24, 2026 01:59
@edison1105
edison1105 merged commit a429b2a into vuejs:minor Sep 24, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: vapor related to vapor mode

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vapor: hydration throws for a custom element or a nested <template> with children

2 participants