-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
fix: handle nullish dynamic event name with event modifiers #13060
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
base: main
Are you sure you want to change the base?
Conversation
Size ReportBundles
Usages
|
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
/ecosystem-ci run |
📝 Ran ecosystem CI: Open
|
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.
I think this PR needs the minor
label. withDynamicEventModifiers
in the compiler output won't be compatible with earlier versions of the runtime, so I don't think it can go in a patch release.
eventName: string, | ||
modifierPostfix: string, | ||
): string { | ||
if (eventName != null && eventName !== '') return eventName + modifierPostfix |
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.
Are there any circumstances where eventName
would be null
or undefined
? From the test cases it seems like _toHandlerKey
would have already converted those to empty strings.
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.
Thanks for your review. Sorry I didn't notice the review right away. The eventName can only be a string. I will modify it.
WalkthroughA new runtime helper and utility function were introduced to handle dynamic event names with modifiers in Vue's compiler and runtime. The transformation logic for dynamic event keys with modifiers was updated, and corresponding tests were added to verify correct handling, especially when the event name is nullish or empty. Changes
Sequence Diagram(s)sequenceDiagram
participant Template
participant Compiler
participant RuntimeHelpers
participant Runtime
Template->>Compiler: Uses @[eventName].modifier="handler"
Compiler->>RuntimeHelpers: Calls V_ON_WITH_DYNAMIC_EVENT_MODIFIERS(eventName, modifierPostfix)
RuntimeHelpers->>Runtime: Registers withDynamicEventModifiers helper
Runtime->>Runtime: withDynamicEventModifiers(eventName, modifierPostfix)
Runtime-->>Template: Returns correct event attribute or empty string
Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes found. Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
4c8493b
to
d2d2e3d
Compare
close #13056
Summary by CodeRabbit
New Features
Tests