fix(runtime-vapor): implement v-once caching for props and attrs#14207
fix(runtime-vapor): implement v-once caching for props and attrs#14207edison1105 merged 2 commits intominorfrom
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit 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)
Comment |
Size ReportBundles
Usages
|
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/compiler-vapor
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/runtime-vapor
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
There was a problem hiding this comment.
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
withOnceCachehelper function to centralize the caching logic for both props and attrs - Adds
oncePropsCachefield toVaporComponentInstanceto store cached prop/attr values per instance - Updates proxy handlers to use cached getters when
onceis 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.
No description provided.