Skip to content

fix(compiler-vapor): add key to object shorthand of aliases with default or computed key - #15953

Merged
edison1105 merged 1 commit into
vuejs:minorfrom
meta-syntax:fix/compiler-vapor-v-for-default-shorthand
Oct 20, 2026
Merged

edison1105 merged 1 commit into
vuejs:minorfrom
meta-syntax:fix/compiler-vapor-v-for-default-shorthand

Conversation

@meta-syntax

Copy link
Copy Markdown

In Vapor, using a destructured v-for / v-slot alias with a default value or a computed key in an object shorthand generates invalid JS:

<div v-for="{ a = 3 } in list">{{ JSON.stringify({ a }) }}</div>
JSON.stringify({ _getDefaultValue(_for_item0.value.a, () => (3)) }) // SyntaxError

In VDOM, this renders {"a":3}.

genIdentifier adds the key (a: ) to a shorthand only when the alias is replaced with a string.
When the replacement is an expression (default value or computed key), it returns the expression without the key. This PR adds the key in that branch too, using the same shorthand check as the string branch.

The added tests fail without the fix.

@coderabbitai

coderabbitai Bot commented Oct 20, 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: 09fc0d29-56f7-4fb8-a4b8-794803fc3d0c

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

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

@pkg-pr-new

pkg-pr-new Bot commented Oct 20, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vue/compiler-core

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

@vue/compiler-dom

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

@vue/compiler-sfc

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

@vue/compiler-ssr

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

@vue/compiler-vapor

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

@vue/reactivity

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

@vue/runtime-core

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

@vue/runtime-dom

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

@vue/runtime-vapor

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

@vue/server-renderer

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

@vue/shared

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

vue

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

@vue/compat

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

commit: 3859f47

@github-actions

Copy link
Copy Markdown

Size Report

Bundles

File Size Gzip Brotli
compiler-dom.global.prod.js 87.4 kB 30.7 kB 27 kB
runtime-dom.global.prod.js 119 kB 44.8 kB 40.1 kB
vue.global.prod.js 180 kB 65.1 kB 58 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 54.6 kB 21.2 kB 19.4 kB
createApp 63.5 kB 24.5 kB 22.2 kB
createApp + vaporInteropPlugin 139 kB 50.2 kB 45 kB
createVaporApp 34.2 kB 13.2 kB 12.2 kB
createSSRApp 68.6 kB 26.5 kB 24.1 kB
createVaporSSRApp 41.1 kB 15.7 kB 14.4 kB
defineCustomElement 70.1 kB 26.5 kB 24.1 kB
defineVaporCustomElement 49.1 kB 18 kB 16.6 kB
overall 79.1 kB 30 kB 27.2 kB

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

2 participants