Skip to content

fix(runtime-vapor): implement v-once caching for props and attrs#14207

Merged
edison1105 merged 2 commits intominorfrom
edison/fix/vOnce
Dec 16, 2025
Merged

fix(runtime-vapor): implement v-once caching for props and attrs#14207
edison1105 merged 2 commits intominorfrom
edison/fix/vOnce

Conversation

@edison1105
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings December 16, 2025 03:55
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Dec 16, 2025

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.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch edison/fix/vOnce

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

@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 16, 2025

Size Report

Bundles

File Size Gzip Brotli
compiler-dom.global.prod.js 85.2 kB 29.9 kB 26.4 kB
runtime-dom.global.prod.js 108 kB 40.6 kB 36.5 kB
vue.global.prod.js 166 kB 60.5 kB 53.9 kB

Usages

Name Size Gzip Brotli
createApp (CAPI only) 48.2 kB 18.9 kB 17.3 kB
createApp 57.2 kB 22 kB 20.1 kB
createApp + vaporInteropPlugin 96.2 kB (+50 B) 35.5 kB (+25 B) 32 kB (+39 B)
createVaporApp 42.2 kB (+50 B) 15.5 kB (+35 B) 14.2 kB (+11 B)
createSSRApp 61.6 kB 23.8 kB 21.7 kB
defineCustomElement 63.3 kB 23.9 kB 21.8 kB
overall 71.9 kB 27.2 kB 24.8 kB

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Dec 16, 2025

Open in StackBlitz

@vue/compiler-core

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

@vue/compiler-dom

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

@vue/compiler-sfc

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

@vue/compiler-ssr

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

@vue/compiler-vapor

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

@vue/reactivity

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

@vue/runtime-core

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

@vue/runtime-dom

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

@vue/runtime-vapor

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

@vue/server-renderer

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

@vue/shared

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

vue

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

@vue/compat

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

commit: 31957b8

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements v-once caching for props and attrs in the runtime-vapor package. Previously, v-once would only pause tracking during property access but did not actually cache the values. This change adds proper caching so that props and attrs accessed within v-once blocks are frozen at their initial values, even when the parent component passes updated values.

Key changes:

  • Introduces a withOnceCache helper function to centralize the caching logic for both props and attrs
  • Adds oncePropsCache field to VaporComponentInstance to store cached prop/attr values per instance
  • Updates proxy handlers to use cached getters when once is true

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/runtime-vapor/src/componentProps.ts Adds withOnceCache helper and refactors props/attrs handlers to use proper caching instead of just pausing tracking
packages/runtime-vapor/src/component.ts Adds oncePropsCache field to store cached prop/attr values for v-once functionality
packages/runtime-vapor/__tests__/component.spec.ts Adds comprehensive tests verifying v-once behavior for both props and attrs, ensuring values remain frozen when parent updates but local state changes still work

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@edison1105 edison1105 merged commit be2b79d into minor Dec 16, 2025
17 checks passed
@edison1105 edison1105 deleted the edison/fix/vOnce branch December 16, 2025 05:54
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