-
Notifications
You must be signed in to change notification settings - Fork 11
fix(): allow setting target event for event actions #4824
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
|
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. Walkthrough重构 Changes
Estimated code review effort🎯 3 (中等) | ⏱️ ~25 分钟
概览
更改
预估代码审查工作量🎯 3 (中等) | ⏱️ ~25 分钟
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Cache: Disabled due to data retention organization setting Knowledge base: Disabled due to data retention organization setting 📒 Files selected for processing (2)
🚧 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). (2)
🔇 Additional comments (3)
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 |
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to data retention organization setting
📒 Files selected for processing (1)
packages/runtime/src/internal/bindListeners.ts(2 hunks)
⏰ 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). (4)
- GitHub Check: CodeQL analysis (javascript-typescript)
- GitHub Check: Agent
- GitHub Check: build (20.x)
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
packages/runtime/src/internal/bindListeners.ts (1)
208-211: 代码重构合理,逻辑清晰。将
event.preventDefault和event.stopPropagation的处理提取到独立的handleEventAction函数中,保持了与其他事件处理器的一致性。
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 modifies the event action handlers for event.preventDefault and event.stopPropagation to allow specifying a target event through arguments, rather than always acting on the triggering event.
Key Changes:
- Refactored event action handling to use a new
handleEventActionfunction instead of directly calling methods - The new function evaluates arguments to determine which event object to act upon
- Falls back to the original event when no arguments are provided
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| useEventAsDefault: true, | ||
| }); | ||
| const [e] = computedArgs as [Event]; | ||
| if (e) { |
Copilot
AI
Nov 17, 2025
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.
The function lacks validation to ensure the computed argument is actually an Event object. If args evaluates to a non-Event value (e.g., a string or number), the code will fail silently when e is truthy but doesn't have the required method, or could throw a runtime error. Consider adding type validation: if (e && typeof e === 'object' && method in e) { e[method](); }
| if (e) { | |
| if (e && typeof e === "object" && typeof e[method] === "function") { |
9fad896 to
351d7dc
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v3 #4824 +/- ##
==========================================
- Coverage 95.19% 95.17% -0.02%
==========================================
Files 212 212
Lines 9343 9348 +5
Branches 1799 1800 +1
==========================================
+ Hits 8894 8897 +3
- Misses 330 331 +1
- Partials 119 120 +1
🚀 New features to boost your workflow:
|
next-core
|
||||||||||||||||||||||||||||
| Project |
next-core
|
| Branch Review |
steve/v3-event-action-target
|
| Run status |
|
| Run duration | 00m 24s |
| Commit |
|
| Committer | Shenwei Wang |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
0
|
|
|
0
|
|
|
0
|
|
|
17
|
| View all changes introduced in this branch ↗︎ | |
依赖检查
组件之间的依赖声明,是微服务组件架构下的重要信息,请确保其正确性。
请勾选以下两组选项其中之一:
或者:
提交信息检查
Git 提交信息将决定包的版本发布及自动生成的 CHANGELOG,请检查工作内容与提交信息是否相符,并在以下每组选项中都依次确认。
破坏性变更:
feat作为提交类型。BREAKING CHANGE: 你的变更说明。新特性:
feat作为提交类型。问题修复:
fix作为提交类型。杂项工作:
即所有对下游使用者无任何影响、且没有必要显示在 CHANGELOG 中的改动,例如修改注释、测试用例、开发文档等:
chore,docs,test等作为提交类型。Summary by CodeRabbit
发布说明
此版本为内部改进,对用户无直接影响。