-
-
Notifications
You must be signed in to change notification settings - Fork 334
refactor: migrate rc-overflow to @rc-component/overflow #953
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
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. 工作流概述将项目依赖从 变更内容
预估代码审查工作量🎯 1 (简单) | ⏱️ ~5 分钟
诗
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ 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 |
Summary of ChangesHello @yoyo837, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on updating the project's dependency management by replacing the legacy Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request replaces the rc-overflow dependency with @rc-component/overflow. The changes are mostly straightforward, but I've identified a critical type issue that will likely cause a compilation error, and a high-severity risk of a regression related to the maxTagCount prop's 'responsive' value. Please see my comments for details and suggestions.
|
|
||
| // ========================= Item ========================= | ||
| function renderSelector(content: React.ReactNode, onClose?: React.MouseEventHandler) { | ||
| function renderSelector(content: React.ReactNode, onClose?: MouseEventHandler<HTMLSpanElement>) { |
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.
While making the onClose handler's type more specific to MouseEventHandler<HTMLSpanElement> is a good intention, it creates a type conflict. The renderSelector function is called from renderItem with an onClose handler whose event argument is typed as React.MouseEvent (which defaults to MouseEvent<Element>). An argument of type MouseEvent<Element> is not assignable to a parameter of type MouseEvent<HTMLSpanElement>, which will likely cause a TypeScript compilation error. To fix this, you can revert this change.
| function renderSelector(content: React.ReactNode, onClose?: MouseEventHandler<HTMLSpanElement>) { | |
| function renderSelector(content: React.ReactNode, onClose?: React.MouseEventHandler) { |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #953 +/- ##
=======================================
Coverage 98.80% 98.80%
=======================================
Files 65 65
Lines 2680 2680
Branches 719 739 +20
=======================================
Hits 2648 2648
Misses 29 29
Partials 3 3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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: 0
🧹 Nitpick comments (2)
src/PickerInput/Selector/SingleSelector/MultipleDates.tsx (2)
7-10: MultipleDatesProps 只从 PickerProps 中挑出 maxTagCount 没问题,但可以考虑透传泛型。目前写成
Pick<PickerProps, 'maxTagCount'>在类型上是可行的;如果想让 DateType 一路贯通、在未来 PickerProps 对该字段做泛型约束时更稳妥,可改为:-export interface MultipleDatesProps<DateType extends object = any> extends Pick< - PickerProps, +export interface MultipleDatesProps<DateType extends object = any> extends Pick< + PickerProps<DateType>, 'maxTagCount' > {属于可选的类型增强,不影响当前功能。
39-39: renderSelector 中 onClose 类型收窄为 MouseEventHandler 更贴合实际 DOM 元素。这一收窄与下方
className={${selectionCls}-item-remove}的<span>完全对应,有利于类型检查;进一步统一的话,可以让renderItem里的onClose也显式使用同一类型并去掉可选参数,例如:- const onClose = (event?: React.MouseEvent) => { - if (event) event.stopPropagation(); + const onClose: MouseEventHandler<HTMLSpanElement> = (event) => { + event.stopPropagation(); onRemove(date); };这能让调用与 React 的事件签名完全一致。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
package.json(1 hunks)src/PickerInput/Selector/SingleSelector/MultipleDates.tsx(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/PickerInput/Selector/SingleSelector/MultipleDates.tsx (1)
src/PickerInput/SinglePicker.tsx (1)
PickerProps(102-104)
⏰ 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). (1)
- GitHub Check: test / react component workflow
🔇 Additional comments (2)
src/PickerInput/Selector/SingleSelector/MultipleDates.tsx (1)
2-4: Overflow 引用切换到新包,同时使用 type-only 引入 MouseEventHandler 很合适。
Overflow从@rc-component/overflow引入与 package.json 中的依赖一致,import type { MouseEventHandler }也避免了多余的运行时代码,整体改动干净且对外行为不变。package.json (1)
111-116: Migration from rc-overflow to @rc-component/overflow is complete and correct.The new
@rc-component/overflowdependency is properly declared in package.json and actively imported in source code. No lingering references to the oldrc-overflowpackage were found in the codebase.
Summary by CodeRabbit
Chores
Refactor
✏️ Tip: You can customize this high-level summary in your review settings.