fix(compiler-dom): preserve empty dynamic event names#14929
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughFixed a bug where dynamic event bindings with option modifiers (e.g., ChangesDynamic Event Handler Modifier Fix
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested labels
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f1ff403805
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| key, | ||
| `) && (`, | ||
| key, |
There was a problem hiding this comment.
Avoid evaluating dynamic event arguments twice
For dynamic event options such as <div @[nextEvent()].once="handler" />, this emits the key expression on both sides of &&, so nextEvent() runs twice whenever it returns a truthy handler key. That can register the listener under a different event than the one checked, or trigger user-visible side effects during each render; before this change the dynamic key was evaluated once for .once/.capture/.passive.
Useful? React with 👍 / 👎.
|
duplicate of #13060 |
Fixes #13056.\n\nDynamic event names with option modifiers currently append the modifier suffix even when the normalized handler key is empty, so @[event].once can become an "Once" attribute when event is nullish or empty. This keeps the generated key empty unless the dynamic handler key exists.\n\nTest: pnpm vitest packages/compiler-dom/tests/transforms/vOn.spec.ts --run
Summary by CodeRabbit
Bug Fixes
@[event].once) in Vue template compilation.Tests