Skip to content

Conversation

@QDyanbing
Copy link
Contributor

@QDyanbing QDyanbing commented Jan 22, 2026

本次修改补充 SubMenuTypepopupRender 类型定义,修复 TS 类型检查报错问题。

fix ant-design/ant-design#56706

变更内容

  • SubMenuType 中补充 popupRender?: PopupRender 的类型定义

影响范围

  • 仅类型定义变更,不影响运行时逻辑

Summary by CodeRabbit

  • 新功能
    • 支持通过全局/上下文配置为子菜单自定义弹出框渲染,便于统一定制弹出表现。
  • 重构
    • 移除单个子菜单组件上的 per-instance popupRender 属性(不再支持通过组件属性逐个定制),请改用上下文/全局配置以实现自定义渲染。

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

@gemini-code-assist
Copy link

Summary of Changes

Hello @QDyanbing, 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!

此拉取请求旨在通过在 SubMenuType 接口中添加缺失的 popupRender 属性类型定义来解决一个 TypeScript 类型检查错误。此项修改纯粹是类型定义上的调整,不会对运行时逻辑产生任何影响,确保了代码的类型安全性和一致性。

Highlights

  • 类型定义修复: 为 SubMenuType 接口补充了 popupRender 属性的类型定义,以解决 TypeScript 类型检查报错问题。

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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.

@coderabbitai
Copy link

coderabbitai bot commented Jan 22, 2026

Walkthrough

SubMenuType 接口中新增可选属性 popupRender?: PopupRender;同时在 src/SubMenu/index.tsx 中移除了公开 prop popupRender 的声明,改为依赖上下文或默认行为;测试中的 MockResizeObserver 改为具名常量并添加静态式属性初始化。

Changes

Cohort / File(s) 变更摘要
类型定义补充
src/interface.ts
SubMenuType 接口添加可选属性 popupRender?: PopupRender(补全文档中存在的类型声明)。
SubMenu Props 调整
src/SubMenu/index.tsx
从导入与 SubMenuProps 中移除公开的 popupRender 声明;组件不再通过实例 prop 接收 popupRender,依赖上下文或默认实现。
测试辅助调整
tests/Responsive.spec.tsx
将匿名 forwardRef 返回替换为具名 MockResizeObserver 常量,并为其添加 useResizeObserver 属性初始化(兼容无 RO.useResizeObserver 的场景)。

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 新增一行不惊风,
接口补全守文中,
子菜单静候上下文,
测试小改更稳重,
小兔一跃庆功红 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning 检测到超出范围的变更:src/SubMenu/index.tsx中移除了popupRender属性与相关导入,与修复类型定义的主要目标不一致。 应恢复src/SubMenu/index.tsx中的popupRender属性和导入,确保实现与类型定义保持一致,或澄清设计意图。
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确描述了PR的主要变更:向SubMenuType接口添加popupRender属性,与代码变更完全相关。
Linked Issues check ✅ Passed PR满足了关联问题#56706的要求,通过向SubMenuType接口添加popupRender类型定义来解决TS类型检查错误。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

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

本次拉取请求通过在 SubMenuType 接口中添加 popupRender 类型定义,成功解决了 TypeScript 类型检查报错问题。此更改提高了菜单组件接口的类型安全性和正确性。

@Wxh16144
Copy link

ci lint 挂了,还需要看看是什么原因

@codecov
Copy link

codecov bot commented Jan 26, 2026

Codecov Report

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

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #849   +/-   ##
=======================================
  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 27f1a78 into react-component:master Jan 26, 2026
9 checks passed
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.

SubMenuType 中 popupRender 类型定义缺失

4 participants