-
-
Notifications
You must be signed in to change notification settings - Fork 9k
fix(compiler-vapor): wrap handler values in functions for dynamic v-on #14218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
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 fixes the handling of dynamic v-on directives in the Vapor compiler by wrapping handler values in functions to preserve reactivity. When using v-on="obj" syntax in Vapor mode, the handlers from the object need to be wrapped in functions so they can be evaluated lazily and maintain reactivity to changes in the source object.
Key Changes:
- Added a
needWrapparameter to thetoHandlershelper function to optionally wrap handler values in functions - Updated the Vapor compiler's component generator to pass
needWrap: truewhen processing dynamic v-on directives - Updated test expectations and snapshots to reflect the new generated code with wrapped handlers
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/runtime-core/src/helpers/toHandlers.ts | Adds optional needWrap parameter that wraps each handler value in an arrow function when true |
| packages/compiler-vapor/src/generators/component.ts | Updates toHandlers call to pass false for preserveCaseIfNecessary and true for needWrap |
| packages/compiler-vapor/tests/transforms/transformElement.spec.ts | Updates test expectation to include the new boolean parameters in toHandlers call |
| packages/compiler-vapor/tests/transforms/snapshots/transformSlotOutlet.spec.ts.snap | Updates snapshot with new toHandlers signature |
| packages/compiler-vapor/tests/transforms/snapshots/transformElement.spec.ts.snap | Updates snapshot with new toHandlers signature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.