Skip to content

fix(compiler-vapor): parenthesize loose conditions in the className fast path - #15709

Merged
edison1105 merged 2 commits into
vuejs:minorfrom
ValentinYoushkevich:fix/vapor-class-fast-path-parens
Sep 29, 2026
Merged

edison1105 merged 2 commits into
vuejs:minorfrom
ValentinYoushkevich:fix/vapor-class-fast-path-parens

Conversation

@ValentinYoushkevich

Copy link
Copy Markdown
Contributor

The setClassName fast path from #14803 inlines each class condition as the test of cond ? bit : 0 without parentheses. A condition that binds looser than that test, such as a ternary, an assignment or an arrow, swallows ? bit : 0 and the wrong class is rendered. Real case: wordle_plus App.vue with { correct: el.correct ? true : false, hint: el.hint ? true : false, ... }, where a hint tile gets correct. Playground

Such conditions are now wrapped in parentheses. Output for other conditions is unchanged.

@coderabbitai

coderabbitai Bot commented Sep 29, 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: 6f58a0f4-9c88-41db-bdf2-bc3f0a3a5d4f

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 29, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@vue/compiler-core

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

@vue/compiler-dom

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

@vue/compiler-sfc

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

@vue/compiler-ssr

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

@vue/compiler-vapor

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

@vue/reactivity

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

@vue/runtime-core

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

@vue/runtime-dom

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

@vue/runtime-vapor

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

@vue/server-renderer

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

@vue/shared

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

vue

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

@vue/compat

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

commit: e9c82c9

@github-actions

github-actions Bot commented Sep 29, 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.9 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.9 kB 23.9 kB 21.7 kB
createApp + vaporInteropPlugin 126 kB 45.3 kB 40.8 kB
createVaporApp 31.6 kB 12.2 kB 11.2 kB
createSSRApp 66.9 kB 25.9 kB 23.6 kB
createVaporSSRApp 38.4 kB 14.6 kB 13.4 kB
defineCustomElement 68.4 kB 25.9 kB 23.5 kB
defineVaporCustomElement 47 kB 17.1 kB 15.7 kB
overall 77.4 kB 29.4 kB 26.7 kB

@edison1105

Copy link
Copy Markdown
Member

Could we simply parenthesize every generated condition here instead of checking AST types?

genExpression() can change the expression's precedence. For example, n++ with an inline SETUP_LET binding becomes _isRef(n) ? n.value++ : n++, but its original AST is an UpdateExpression, so this check misses it.

Always emitting ((condition) ? bit : 0) would be simpler and cover this case too, without adding runtime operations.

@ValentinYoushkevich

Copy link
Copy Markdown
Contributor Author

Good catch, thanks. Every condition is now parenthesized (e9c82c9), and the test covers the inline SETUP_LET n++ case.

@edison1105
edison1105 merged commit 861e630 into vuejs:minor Sep 29, 2026
15 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.

2 participants