Skip to content

fix(compiler-vapor): drop whitespace between v-if branches - #15796

Merged
edison1105 merged 2 commits into
vuejs:minorfrom
ValentinYoushkevich:fix/vapor-v-if-branch-whitespace
Oct 8, 2026
Merged

edison1105 merged 2 commits into
vuejs:minorfrom
ValentinYoushkevich:fix/vapor-v-if-branch-whitespace

Conversation

@ValentinYoushkevich

@ValentinYoushkevich ValentinYoushkevich commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

A space between v-if / v-else-if / v-else branches on the same line ends up in the vapor template, while vdom and SSR drop it. Besides the stray text node, codegen counts that space as a separate child but the browser merges it with the following text, so an interpolation right after the chain makes the component throw on mount (Cannot read properties of undefined (reading '$txt')).

Whitespace-only text between ordinary conditional branches is excluded from the Vapor template and node locators, matching processIf in compiler-core. Sibling detection excludes <template v-slot> definitions, preserving whitespace that belongs to an implicit default slot and keeping SSR hydration aligned. Components using v-slot with v-if / v-else still follow ordinary branch handling.

Real-world example. Playground

Regression coverage uses compiled SFCs to compare Vapor and VDOM mounting and updates with both whitespace modes, including v-else-if, ordinary template branches, comments, <pre>, whitespace after a conditional chain, and component-level v-slot. An SSR hydration regression verifies that conditional named slots preserve the default slot whitespace and following element without mismatches.

Validation:

  • vp test packages/compiler-vapor packages/runtime-vapor --project unit --project unit-jsdom --run: 95 files passed; 3,738 passed, 2 expected failures, 15 todo.
  • Type checking, lint, formatting, and git diff --check passed.
  • Browser e2e was not run.

@coderabbitai

coderabbitai Bot commented Oct 7, 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: 9c1b586d-69fe-47d8-975e-186041ede1c3

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
  • Autopilot · 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

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

@pkg-pr-new

pkg-pr-new Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@vue/compiler-core

pnpm add https://pkg.pr.new/@vue/compiler-core@15796
npm i https://pkg.pr.new/@vue/compiler-core@15796
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/compiler-dom

pnpm add https://pkg.pr.new/@vue/compiler-dom@15796
npm i https://pkg.pr.new/@vue/compiler-dom@15796
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/compiler-sfc

pnpm add https://pkg.pr.new/@vue/compiler-sfc@15796
npm i https://pkg.pr.new/@vue/compiler-sfc@15796
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/compiler-ssr

pnpm add https://pkg.pr.new/@vue/compiler-ssr@15796
npm i https://pkg.pr.new/@vue/compiler-ssr@15796
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/compiler-vapor

pnpm add https://pkg.pr.new/@vue/compiler-vapor@15796
npm i https://pkg.pr.new/@vue/compiler-vapor@15796
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/reactivity

pnpm add https://pkg.pr.new/@vue/reactivity@15796
npm i https://pkg.pr.new/@vue/reactivity@15796
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/runtime-core

pnpm add https://pkg.pr.new/@vue/runtime-core@15796
npm i https://pkg.pr.new/@vue/runtime-core@15796
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/runtime-dom

pnpm add https://pkg.pr.new/@vue/runtime-dom@15796
npm i https://pkg.pr.new/@vue/runtime-dom@15796
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/runtime-vapor

pnpm add https://pkg.pr.new/@vue/runtime-vapor@15796
npm i https://pkg.pr.new/@vue/runtime-vapor@15796
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/server-renderer

pnpm add https://pkg.pr.new/@vue/server-renderer@15796
npm i https://pkg.pr.new/@vue/server-renderer@15796
yarn add https://pkg.pr.new/@vue/[email protected]

@vue/shared

pnpm add https://pkg.pr.new/@vue/shared@15796
npm i https://pkg.pr.new/@vue/shared@15796
yarn add https://pkg.pr.new/@vue/[email protected]

vue

pnpm add https://pkg.pr.new/vue@15796
npm i https://pkg.pr.new/vue@15796
yarn add https://pkg.pr.new/[email protected]

@vue/compat

pnpm add https://pkg.pr.new/@vue/compat@15796
npm i https://pkg.pr.new/@vue/compat@15796
yarn add https://pkg.pr.new/@vue/[email protected]

commit: 3547299

@github-actions

github-actions Bot commented Oct 7, 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 117 kB 43.9 kB 39.3 kB
vue.global.prod.js 177 kB 64 kB 57 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 53.2 kB 20.7 kB 18.9 kB
createApp 62 kB 23.9 kB 21.8 kB
createApp + vaporInteropPlugin 129 kB 46.6 kB 41.9 kB
createVaporApp 34.1 kB 13.1 kB 12 kB
createSSRApp 67 kB 26 kB 23.6 kB
createVaporSSRApp 40.8 kB 15.5 kB 14.2 kB
defineCustomElement 68.5 kB 25.9 kB 23.6 kB
defineVaporCustomElement 48.6 kB 17.7 kB 16.3 kB
overall 77.5 kB 29.5 kB 26.7 kB

@edison1105 edison1105 added the scope: vapor related to vapor mode label Oct 8, 2026
@edison1105
edison1105 merged commit 8b32aa8 into vuejs:minor Oct 8, 2026
14 of 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.

2 participants