Skip to content

fix(runtime-vapor): assign to exposed refs through template refs - #15522

Merged
edison1105 merged 2 commits into
vuejs:minorfrom
ValentinYoushkevich:fix/vapor-expose-ref-write
Sep 15, 2026
Merged

edison1105 merged 2 commits into
vuejs:minorfrom
ValentinYoushkevich:fix/vapor-expose-ref-write

Conversation

@ValentinYoushkevich

Copy link
Copy Markdown
Contributor

Assigning to an exposed ref through a template ref doesn't reach the child in Vapor. With defineExpose({ visible }) in the child and child.value.visible = true in the parent, VDOM sets the child's visible ref, while Vapor replaces the ref on the exposed object with a plain value. The child's state and UI never change, but the parent reads back what it wrote, so the two silently drift apart. The same happens with a writable computed and a shallowRef, and writing to a readonly computed quietly succeeds instead of warning. Playground

getExposed in runtime-vapor/src/component.ts wraps the exposed object in a proxy that unwraps refs on read but has no set trap, so an assignment goes straight to the underlying object.

VDOM wraps the exposed object in proxyRefs, whose set writes to .value when the existing property is a ref and the new value isn't. I added the same set trap to the Vapor proxy and left reads as they were. The test covers a ref, a writable computed, a shallowRef, a plain value and the readonly computed warning, with the template ref declared as ref().

@coderabbitai

coderabbitai Bot commented Sep 15, 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: cfb08a6f-3fc7-4b59-94e1-6957822b5c6b

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

Copy link
Copy Markdown

Open in StackBlitz

@vue/compiler-core

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

@vue/compiler-dom

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

@vue/compiler-sfc

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

@vue/compiler-ssr

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

@vue/compiler-vapor

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

@vue/reactivity

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

@vue/runtime-core

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

@vue/runtime-dom

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

@vue/runtime-vapor

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

@vue/server-renderer

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

@vue/shared

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

vue

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

@vue/compat

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

commit: 970ad99

@github-actions

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.7 kB 39.1 kB
vue.global.prod.js 176 kB 63.9 kB 56.8 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 53.2 kB 20.6 kB 18.8 kB
createApp 61.9 kB 23.8 kB 21.7 kB
createApp + vaporInteropPlugin 120 kB 43 kB 38.7 kB
createVaporApp 30.6 kB (+85 B) 11.8 kB (+37 B) 10.8 kB (+26 B)
createSSRApp 67.1 kB 25.9 kB 23.5 kB
createVaporSSRApp 36.8 kB (+85 B) 14 kB (+37 B) 12.8 kB (+33 B)
defineCustomElement 68.5 kB 25.8 kB 23.5 kB
defineVaporCustomElement 46 kB (+83 B) 16.7 kB (+37 B) 15.4 kB (+58 B)
overall 77.3 kB 29.4 kB 26.6 kB

@edison1105 edison1105 added the scope: vapor related to vapor mode label Sep 15, 2026
@edison1105
edison1105 merged commit 11392af into vuejs:minor Sep 15, 2026
15 checks passed
@ValentinYoushkevich
ValentinYoushkevich deleted the fix/vapor-expose-ref-write branch September 17, 2026 04:43
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