Skip to content

Conversation

@yoyo837
Copy link
Member

@yoyo837 yoyo837 commented Dec 4, 2025

Summary by CodeRabbit

  • Chores

    • 更新了项目依赖:替换并统一溢出处理组件为新的包,调整依赖声明(对用户功能无影响)。
    • 临时调整了一个小依赖项的声明(实际行为未改变)。
  • Tests

    • 更新了测试中的观察器依赖引用以匹配新包名(测试逻辑不变)。

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 4, 2025

Walkthrough

将依赖从 rc-overflow 切换为 @rc-component/overflow,并在 Menu、MenuItem、SubMenu 三个组件以及相关测试中更新对应导入路径;在 package.json 中替换依赖条目,且未修改公共 API 或功能逻辑。

Changes

内聚关系 / 文件(s) 变更摘要
依赖清单
package.json
将依赖 rc-overflow: ^1.3.1 移除,新增 @rc-component/overflow: ^1.0.0clsx 声明未实质改变
组件导入更新
src/Menu.tsx, src/MenuItem.tsx, src/SubMenu/index.tsx
rc-overflow 的导入源替换为 @rc-component/overflowsrc/Menu.tsx 同时微调了 MenuProps 类型的格式化(仅语法/格式变化)
测试导入更新
tests/Responsive.spec.tsx
rc-resize-observer 的测试 mock/import 切换为 @rc-component/resize-observer,仅模块路径替换,无测试逻辑改动

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 分钟

  • 变更模式一致、跨文件重复性高,主要为依赖与导入路径替换。
  • 建议重点检查:
    • package.json 的依赖解析与锁文件(若有)是否同步更新。
    • 所有替换的导入在构建/打包器中能否正确解析(模块名/导出兼容性)。
    • 测试中 mock 的模块路径与真实实现是否保持一致。

Poem

🐰 我在代码园中跳跃,
路径从旧巢换新穴,
一行行轻移不惊扰,
依赖更新月色明,
小兔拍拍手,继续奔走 💫

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题清晰准确地总结了PR的主要改动:将rc-overflow依赖迁移至@rc-component/overflow,并在所有相关文件中完成了这个替换。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch drop-rc-overflow

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9645ec6 and 59faeea.

📒 Files selected for processing (1)
  • tests/Responsive.spec.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-23T06:01:34.975Z
Learnt from: codewizardTM
Repo: react-component/menu PR: 818
File: src/Menu.tsx:415-431
Timestamp: 2025-10-23T06:01:34.975Z
Learning: In src/Menu.tsx focus logic, defaultFocusKey should only use keys from focusableElements/key2element, not from childList.find(), because childList items might not be rendered in DOM (e.g., in overflow menu) which would cause focus to fail.

Applied to files:

  • tests/Responsive.spec.tsx
🔇 Additional comments (2)
tests/Responsive.spec.tsx (2)

11-29: jest.mock 配置与新包路径保持一致,mock 行为未改变

jest.mock 的模块名和 jest.requireActual 的路径都已同步为 @rc-component/resize-observer,其余 forwardRef 包装与 global.resizeProps 记录逻辑保持不变,兼容之前的测试假设。

建议顺手确认生产代码和其他测试也都已统一切换到 @rc-component/resize-observer,避免混用新旧包名导致的双实例问题。


3-3: ResizeObserver import path updated consistently with dependency migration

Import statement and jest.mock configuration both reference @rc-component/resize-observer correctly. No remaining references to the old rc-resize-observer package found in the repository. Mock wrapper behavior and default export usage remain unchanged, so existing test behavior is unaffected.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link

Summary of Changes

Hello @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 a dependency update, migrating the project from the legacy rc-overflow package to the more modern and consistent @rc-component/overflow package. This change aligns the project with the @rc-component ecosystem, potentially offering better maintenance, compatibility, and features. The update involves modifying the package.json file and adjusting import statements across several UI components to reflect the new package name.

Highlights

  • Dependency Migration: The rc-overflow package has been replaced with the scoped @rc-component/overflow package in the project dependencies.
  • Import Path Updates: All relevant component files (src/Menu.tsx, src/MenuItem.tsx, src/SubMenu/index.tsx) have been updated to import the Overflow component from the new @rc-component/overflow path.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a 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 migrates the project from rc-overflow to the scoped package @rc-component/overflow. The changes are straightforward, involving updates to package.json and import paths in several components. There are also some minor stylistic formatting changes to interface definitions, which improve code readability. The changes appear correct and are consistent with migrating to the new scoped package.

Copy link

@coderabbitai coderabbitai bot left a 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 (1)
src/Menu.tsx (1)

392-407: focus 回退逻辑仍依赖 childList,可能选中未渲染项

focus 逻辑在找不到 mergedActiveKey 时,会优先用 focusableElements 推导 key,但最终还回退到 childList.find(node => !node.props.disabled)?.key。在有 overflow 的场景里,childList 里可能包含未真实挂载到 DOM 的项,导致拿到的 key 在 key2element 中没有对应元素,从而聚焦失败。

建议后续重构时将回退完全限制在 focusableElements/key2element 的结果集合内,例如仅根据已存在的 element2key 映射选择第一个可聚焦元素,而不是再从 childList 做兜底。Based on learnings, ...

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aa32249 and 9645ec6.

📒 Files selected for processing (4)
  • package.json (1 hunks)
  • src/Menu.tsx (2 hunks)
  • src/MenuItem.tsx (2 hunks)
  • src/SubMenu/index.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-23T06:01:34.975Z
Learnt from: codewizardTM
Repo: react-component/menu PR: 818
File: src/Menu.tsx:415-431
Timestamp: 2025-10-23T06:01:34.975Z
Learning: In src/Menu.tsx focus logic, defaultFocusKey should only use keys from focusableElements/key2element, not from childList.find(), because childList items might not be rendered in DOM (e.g., in overflow menu) which would cause focus to fail.

Applied to files:

  • src/Menu.tsx
🧬 Code graph analysis (2)
src/MenuItem.tsx (1)
src/interface.ts (1)
  • MenuItemType (44-63)
src/Menu.tsx (1)
src/index.ts (1)
  • MenuProps (25-25)
🔇 Additional comments (6)
src/SubMenu/index.tsx (1)

3-3: Overflow 导入路径更新看起来正确

这里将 Overflow 的来源切到 @rc-component/overflow,与 package.json 中的新依赖保持一致,后文仍按 <Overflow.Item> 使用,语义不变。建议在本分支上跑一遍构建和现有测试,确认新包的默认导出接口与原 rc-overflow 兼容。

src/Menu.tsx (2)

3-3: Overflow 导入路径更新与依赖一致

Overflow 改为从 @rc-component/overflow 引入,与依赖清单中新增的包对齐;下文继续使用 Overflow 组件及静态成员(如 Overflow.INVALIDATE/RESPONSIVE),只要新包保持兼容导出即可无行为差异。建议在本分支上跑一遍构建和测试,确认类型检查和运行时均正常。


53-56: MenuProps 继承部分仅为排版优化

这里把 MenuPropsextends Omit<...> 拆成多行,只是改善可读性和避免超长行,对外暴露的 MenuProps 类型含义和行为都没有变化,可以保持现状。

src/MenuItem.tsx (2)

2-2: MenuItem 中 Overflow 导入与依赖保持一致

这里把 Overflow 改为从 @rc-component/overflow 引入,下方 LegacyMenuItem 仍按 <Overflow.Item> 使用,接口期望与原先 rc-overflow 一致。整体修改与其他文件、package.json 中的迁移方向统一,逻辑上没有问题。建议在本分支跑一下构建和测试,确认新包的默认导出上仍包含 .Item 等静态成员。


19-21: MenuItemProps 继承列表仅作格式化调整

MenuItemPropsextends 现在拆成多行,阅读性更好,但仍然只是从 MenuItemType 中省略 'label' | 'key' | 'ref',对外暴露的 props 形态与之前保持一致,无需额外改动。

package.json (1)

47-52: Dependency migration from rc-overflow to @rc-component/overflow is complete and consistent

The dependencies block correctly adds @rc-component/overflow@^1.0.0 and removes the old rc-overflow. All Overflow imports in the codebase (MenuItem.tsx, Menu.tsx, SubMenu/index.tsx) have been updated to reference the new package, with no lingering references to rc-overflow remaining.

@afc163 afc163 changed the title chore: drop rc-overflow refactor: migrate rc-overflow to @rc-component/overflow Dec 4, 2025
@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.72%. Comparing base (aa32249) to head (59faeea).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #832   +/-   ##
=======================================
  Coverage   99.72%   99.72%           
=======================================
  Files          26       26           
  Lines         727      727           
  Branches      199      199           
=======================================
  Hits          725      725           
  Misses          2        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@afc163 afc163 merged commit 902cfcd into master Dec 4, 2025
10 checks passed
@afc163 afc163 deleted the drop-rc-overflow branch December 4, 2025 04:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants