Skip to content

fix(runtime-vapor): recover hydration that misses a server range - #16330

Merged
edison1105 merged 2 commits into
vuejs:minorfrom
jrandolf:fix/vapor-mismatch-cursor
Nov 18, 2026
Merged

edison1105 merged 2 commits into
vuejs:minorfrom
jrandolf:fix/vapor-mismatch-cursor

Conversation

@jrandolf

Copy link
Copy Markdown
Contributor

Fixes #16326
Fixes #16327

A component the server rendered with one root has no <!--{--> range. When the client renders more roots, the extra roots read the cursor past that node: they replace the next node, even outside the parent, or throw. A v-for or a teleport with no range of its own under the cursor throws.

  • When a root reads past that node, the node gets the <!--{-->…<!--}--> range the server renders for several roots, and the extra roots go before its close. An empty first root leaves its anchor in the node's place.
  • A v-for or a teleport without its range puts an empty one in place of the server node and renders there.
  • Hydration without a mismatch does no extra DOM work.
  • Four hand-written test fixtures get the ranges the server renders for several roots.

Applies cleanly with #16320, #16323 and #16324; they conflict only with each other.

@coderabbitai

coderabbitai Bot commented Nov 17, 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

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e6e208a2-1f60-47b6-981b-763a014733a7

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
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@jrandolf
jrandolf force-pushed the fix/vapor-mismatch-cursor branch from 4652157 to 76e27a6 Compare November 18, 2026 03:54
@pkg-pr-new

pkg-pr-new Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@vue/compiler-core

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

@vue/compiler-dom

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

@vue/compiler-sfc

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

@vue/compiler-ssr

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

@vue/compiler-vapor

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

@vue/reactivity

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

@vue/runtime-core

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

@vue/runtime-dom

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

@vue/runtime-vapor

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

@vue/server-renderer

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

@vue/shared

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

vue

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

@vue/compat

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

commit: 2b3f66d

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Size Report

Bundles

File Size Gzip Brotli
compiler-dom.global.prod.js 87.5 kB 30.7 kB 27 kB
runtime-dom.global.prod.js 124 kB 46.6 kB 41.8 kB
vue.global.prod.js 185 kB 66.9 kB 59.5 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 55.6 kB 21.6 kB 19.7 kB
createApp 64.9 kB 25 kB 22.7 kB
createApp + vaporInteropPlugin 126 kB 45.9 kB 41.2 kB
createVaporApp 36.1 kB 13.9 kB 12.7 kB
createSSRApp 69.8 kB 27 kB 24.5 kB
createVaporSSRApp 44.4 kB (+537 B) 16.9 kB (+239 B) 15.5 kB (+202 B)
defineCustomElement 71.4 kB 27 kB 24.5 kB
defineVaporCustomElement 51.2 kB 18.7 kB 17.2 kB
overall 81.8 kB 31 kB 28 kB

@jrandolf
jrandolf force-pushed the fix/vapor-mismatch-cursor branch from 76e27a6 to 6e57175 Compare November 18, 2026 05:51
A component the server rendered with one root has no `<!--{-->` range.
When the client renders more roots, the roots after the first read the
cursor past that server unit. They replaced the next node, also outside
the parent element, or threw. A `v-for` or a teleport that found no
server range of its own under the cursor threw as well.

When a root reads the cursor past the unit, give the unit the range
the server renders for several roots. The other roots then go in front
of its close. An empty root that trims the unit leaves its anchor as
the unit. A list or a teleport without its range puts an empty one
in place of the server node, and its content renders in that range.

close vuejs#16326
close vuejs#16327
@jrandolf
jrandolf force-pushed the fix/vapor-mismatch-cursor branch from 6e57175 to 094e690 Compare November 18, 2026 05:56
@edison1105 edison1105 added the scope: vapor related to vapor mode label Nov 18, 2026
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.

2 participants