-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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-ssr
@vue/compiler-sfc
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
@vue/compat
vue
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.
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 ignored due to path filters (1)
📒 Files selected for processing (5)
🧰 Additional context used🧬 Code Graph Analysis (1)packages/runtime-dom/src/directives/vOn.ts (1)
🔇 Additional comments (7)
✨ 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 (
|
close #13056
Summary by CodeRabbit
New Features
Bug Fixes
Tests