Skip to content

Conversation

@afc163
Copy link
Member

@afc163 afc163 commented Jan 4, 2026

Summary by CodeRabbit

  • 维护
    • 更新项目依赖版本(包括 UI 组件库与样式相关依赖),提升兼容性与安全性。
  • 重构
    • 调整表格页面表单项渲染以适配新版组件接口;更新下拉样式合成方式;调整抽屉尺寸配置;优化若干 Alert 的内容呈现方式(由 message 切换为 title)。
  • 测试
    • 在测试环境添加 MessageChannel 运行时 Polyfill,提升无原生支持环境下的测试稳定性。

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

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jan 4, 2026
@github-actions
Copy link

github-actions bot commented Jan 4, 2026

🎊 PR Preview has been successfully built and deployed to https://ant-design-pro-preview-pr-11604.surge.sh

@coderabbitai
Copy link

coderabbitai bot commented Jan 4, 2026

Warning

Rate limit exceeded

@afc163 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 7 minutes and 59 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between d91b409 and c1eff8f.

📒 Files selected for processing (1)
  • .github/workflows/preview-build.yml

Note

Other AI code review bot(s) detected

CodeRabbit 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

更新了 package.json 中的依赖版本;在 src/pages/table-list/index.tsx 中将 ProTable 列的表单渲染钩子由 renderFormItem 替换为 formItemRender(并引入 FormInstance 类型),同时将 Drawerwidth prop 改为 size;在测试引导 tests/setupTests.jsx 中新增 MessageChannel polyfill;调整了若干组件的样式/API 用法:HeaderDropdown 的 Dropdown 样式传递方式由 overlayClassName 改为合并后的 classNames,src/pages/Admin.tsxsrc/pages/user/login/index.tsx 中的 Alert 使用由 message 改为 title

Changes

Cohort / File(s) 变更摘要
依赖版本更新
package.json
更新依赖版本:@ant-design/pro-components^2.8.93.1.0-0antd^6.0.0^6.1.3antd-style^3.7.0^4.1.0。请关注与 ProTable/antd 新版本的兼容性。
ProTable 表单渲染与 Drawer 改动
src/pages/table-list/index.tsx
将列配置中的 renderFormItem 替换为 formItemRender,新签名为 `(item, { defaultRender, ...rest }, form: FormInstance) => ReactNode
测试环境 polyfill
tests/setupTests.jsx
在全局缺失 MessageChannel 时新增 PolyMessageChannel 实现并赋予 global.MessageChannel(并在存在 window 时赋予 window.MessageChannel),用于在 Jest/jsdom 等环境中提供 MessageChannel。
Dropdown 样式传递调整
src/components/HeaderDropdown/index.tsx
不再直接将 overlayClassName 传给 Dropdown,改为与组件根样式合并(通过 classNames.root/合并逻辑)以应用样式。请审查自定义样式传递路径。
Alert prop 用法变更
src/pages/Admin.tsx, src/pages/user/login/index.tsx
Alertmessage prop 改为 title(显示文本由 messagetitle),其余 Alert 属性保持不变。请确认 antd 版本下 title 的展示行为符合预期。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

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 标题准确概括了主要变更内容:更新 antd 依赖版本和相关组件用法,以及修复快照测试。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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 @afc163, 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 core Ant Design related dependencies to their latest versions. Specifically, @ant-design/pro-components and antd-style have been upgraded. These dependency updates have led to necessary adjustments in existing snapshot tests, primarily due to changes in how CSS variables are generated, ensuring the application remains consistent with the updated styling libraries.

Highlights

  • Dependency Updates: The @ant-design/pro-components dependency has been updated to 3.1.0-0 and antd-style has been updated to ^4.1.0.
  • Snapshot Test Adjustments: Snapshot tests for the login page have been updated to reflect changes in generated CSS variable names, ensuring compatibility with the new dependency versions.

🧠 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.

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 updates dependencies for @ant-design/pro-components and antd-style, along with the corresponding snapshot tests. The update for @ant-design/pro-components is to a pre-release version, which introduces potential stability risks. I have added a comment in package.json regarding this. The snapshot test updates appear to be a direct result of these dependency changes and seem correct.

"dependencies": {
"@ant-design/icons": "^6.1.0",
"@ant-design/pro-components": "^2.8.9",
"@ant-design/pro-components": "3.1.0-0",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The version for @ant-design/pro-components is being updated to 3.1.0-0, which is a pre-release version. Using pre-release versions in dependencies can introduce instability and unexpected breaking changes. It is generally recommended to use stable releases for production code. If this change is not for temporary testing, consider using the latest stable version to ensure the project's stability.

@dosubot dosubot bot added the 🛂 antd label Jan 4, 2026
@socket-security
Copy link

socket-security bot commented Jan 4, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​ant-design/​pro-components@​3.1.0-09610010096100

View full report

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jan 4, 2026

Deploying ant-design-pro with  Cloudflare Pages  Cloudflare Pages

Latest commit: c1eff8f
Status: ✅  Deploy successful!
Preview URL: https://5e0fd792.ant-design-pro-nd3.pages.dev
Branch Preview URL: https://fix-update-antd-deps.ant-design-pro-nd3.pages.dev

View logs

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: 1

📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c609c65 and 68d1349.

⛔ Files ignored due to path filters (1)
  • src/pages/user/login/__snapshots__/login.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (1)
  • package.json
⏰ 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)
  • GitHub Check: build-preview
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (2)
package.json (2)

39-41: 快照测试已在此 PR 中更新,无需进一步操作

验证显示快照文件 src/pages/user/login/__snapshots__/login.test.tsx.snap 已在同一提交中被修改,该提交同时更新了 antd 和 antd-style 的版本。快照包含了 antd 组件的完整渲染输出,已反映了新依赖版本的变化。


41-41: 该升级已确认兼容安全

antd-style 从 ^3.7.0 升级到 ^4.1.0 虽然是主版本升级,但已确认与当前项目配置兼容:

  • antd 已升级至 ^6.0.0(满足 antd-style v4 的依赖要求)
  • 项目中仅使用 createStyles API,无兼容性问题
  • v4.1.0 是 npm 上的最新稳定版本

升级可继续进行。

"dependencies": {
"@ant-design/icons": "^6.1.0",
"@ant-design/pro-components": "^2.8.9",
"@ant-design/pro-components": "3.1.0-0",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# 查询 @ant-design/pro-components 在 npm 上的版本信息
curl -s "https://registry.npmjs.org/@ant-design/pro-components" | jq -r '.versions | keys[]' | grep -E "^3\.1\.0" | head -20

Repository: ant-design/ant-design-pro

Length of output: 76


🌐 Web query:

@ant-design/pro-components 3.1.0 release breaking changes

💡 Result:

There is no published @ant-design/pro-components 3.1.0 release. The package on npm is currently in the 2.x line (latest stable 2.8.x) and there are pre-release 3.0.x tags (e.g. 3.0.1-0) — but no 3.1.0 release or changelog entry exists for the main pro-components package. [1][2]

If you meant a different package in the Ant Design Pro family (for example @ant-design/pro-field is at 3.1.0), tell me which package and I’ll fetch that release’s breaking changes. [3]

Sources:

  • npm @ant-design/pro-components (package page showing versions). [1]
  • GitHub releases for ant-design/pro-components (releases/tags list). [2]
  • npm @ant-design/pro-field (example package at 3.1.0). [3]

🌐 Web query:

@ant-design/pro-components version 3.0 migration guide

💡 Result:

Here’s a concise migration checklist for @ant-design/pro-components → v3.0.

  1. Upgrade packages
  • Update antd to v5 (recommended >= 5.11.2) and install ProComponents 3.x:
    npm install antd@^5.11.2 @ant-design/pro-components@^3.0.0
    (or use your package manager). [1][3]
  1. Read the official ProComponents v3 migration doc
  • Follow the project migration guide for component-level breaking changes and examples. [1]
  1. Key breaking changes / things to check
  • AntD v5 CSS-in-JS: antd removed Less-based theming; adapt any Less-based theme/customizations to the new CSS-in-JS approach (@ant-design/cssinjs / antd v5 token API). [4]
  • PageHeader and some pro-specific helpers moved/changed; update imports that referenced moved components (check usages like PageHeader, ProTable, ProForm fields). [1][2]
  • Replace removed/renamed antd APIs per the antd v4→v5 migration notes (codemods available for many changes). Run antd codemods where helpful and manually adjust remaining incompatibilities. [4]
  • Date libs / internals: check for moment → dayjs or other date-library differences if your project depended on moment behaviors. [4]
  1. Run tests and fix TypeScript types
  • v3 may expose stricter types; run your build/tsc and address type errors (ProComponents repo and docs include typedef examples). [2][1]
  1. Helpful commands/tools
  • Try antd codemod for broad API changes: npx -p @ant-design/codemod-v4 antd4-codemod src (adapt as needed), then manual fixes for remaining items. [4]
  • If you need the exact package versions or release notes, check the ProComponents GitHub releases/changelog and npm package page. [2][3]

If you want, I can:

  • fetch the ProComponents v3 migration doc page and list the exact import/rename changes for ProTable/ProForm/PageHeader in your codebase (paste a few example files or the errors you see).

需要验证主版本升级的稳定性和兼容性

该依赖升级到 3.1.0-0 存在以下问题:

  1. 预发布版本3.1.0-0 后缀表示这是预发布版本,不适合用于生产环境
  2. 主版本升级(2.x → 3.x):根据迁移指南,需要将 antd 升级至 v5,涉及多项破坏性变更:
    • 组件 API 变更(PageHeader、ProTable、ProForm 等)
    • antd v5 CSS-in-JS 主题系统,不再支持 Less
    • 类型定义更新
  3. 版本锁定:移除了 ^ 符号,固定在这个预发布版本上,增加了维护风险

建议:

  • 确认是否需要使用预发布版本,考虑等待正式版本发布
  • 验证整个依赖树中 antd 是否已升级至 v5(涉及广泛的兼容性变更)
  • 运行完整的测试套件(包括快照测试)以验证所有组件兼容性

@afc163
Copy link
Member Author

afc163 commented Jan 4, 2026

procomponents 有个报错:

@chenshuai2144

Run bun run lint
$ bun run biome:lint && bun run tsc
$ bun x @biomejs/biome lint
Checked 98 files in 47ms. No fixes applied.
$ tsc --noEmit
Error: src/pages/table-list/index.tsx(153,7): error TS2353: Object literal may only specify known properties, and 'renderFormItem' does not exist in type 'ProColumns<RuleListItem>'.
Error: src/pages/table-list/index.tsx(153,24): error TS7006: Parameter 'item' implicitly has an 'any' type.
Error: src/pages/table-list/index.tsx(153,32): error TS7031: Binding element 'defaultRender' implicitly has an 'any' type.
Error: src/pages/table-list/index.tsx(153,58): error TS7006: Parameter 'form' implicitly has an 'any' type.

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Jan 4, 2026
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/pages/table-list/index.tsx (1)

153-164: formItemRender API 迁移已正确实现。

代码已成功从旧 API 迁移至 formItemRender,函数签名和类型定义都是有效的:

  • formItemRender@ant-design/pro-components 中的正确 API
  • ✓ 函数签名 (item, {defaultRender, ...rest}, form) => React.ReactNode 符合文档规范
  • ✓ 参数类型定义完整,FormInstance 来自 antdProColumns 从库正确导入

需要关注:依赖版本 3.1.0-0 是预发布版本。建议在升级至正式版本(如 3.1.0)后发布到生产环境,以确保长期稳定性。

📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 68d1349 and 842c44f.

📒 Files selected for processing (1)
  • src/pages/table-list/index.tsx
⏰ 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: build (20, windows-latest)
  • GitHub Check: build-preview
  • GitHub Check: build (20, windows-latest)
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (1)
src/pages/table-list/index.tsx (1)

13-13: 正确添加了类型导入。

添加 FormInstance 类型导入是必要的,用于 formItemRender 函数的类型注解。使用 type 关键字进行类型导入符合最佳实践。

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Jan 4, 2026
@codecov
Copy link

codecov bot commented Jan 4, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 53.60%. Comparing base (c609c65) to head (c1eff8f).

Files with missing lines Patch % Lines
src/pages/table-list/index.tsx 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master   #11604   +/-   ##
=======================================
  Coverage   53.60%   53.60%           
=======================================
  Files          84       84           
  Lines         597      597           
  Branches       81       81           
=======================================
  Hits          320      320           
  Misses        277      277           

☔ 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.

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)
tests/setupTests.jsx (1)

30-66: 实现合理,可选择性增强 API 完整性。

MessageChannel polyfill 的实现逻辑正确,能够满足基本的测试环境需求。使用 setTimeout 模拟异步消息传递是合适的做法。

如果后续测试中需要更完整的 MessageChannel API,可以考虑以下可选改进:

  1. 为 port 对象初始化 onmessage 属性为 null,使其更接近原生 API
  2. 添加 start()close() 方法(尽管在大多数测试场景中可能用不到)
🔎 可选的 API 完整性增强
       this.port1 = {
+        onmessage: null,
         postMessage(msg) {
           setTimeout(() => {
             if (
               channel.port2 &&
               typeof channel.port2.onmessage === 'function'
             ) {
               channel.port2.onmessage({ data: msg });
             }
           }, 0);
         },
+        start() {},
+        close() {},
       };
       this.port2 = {
+        onmessage: null,
         postMessage(msg) {
           setTimeout(() => {
             if (
               channel.port1 &&
               typeof channel.port1.onmessage === 'function'
             ) {
               channel.port1.onmessage({ data: msg });
             }
           }, 0);
         },
+        start() {},
+        close() {},
       };
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 842c44f and 27734cd.

📒 Files selected for processing (1)
  • tests/setupTests.jsx
⏰ 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: build (20, windows-latest)
  • GitHub Check: build-preview
  • GitHub Check: build (20, windows-latest)
  • GitHub Check: Cloudflare Pages

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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/pages/user/login/index.tsx (1)

102-110: Alert 组件使用了无效的 prop

antd v6 中的 Alert 组件使用 message 属性(不是 title)来传入主要内容。当前代码使用了不存在的 title 属性,应改为 message 属性。

修复示例
    <Alert
      style={{
        marginBottom: 24,
      }}
      message={content}
      type="error"
      showIcon
    />
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2e47c01 and d91b409.

📒 Files selected for processing (4)
  • src/components/HeaderDropdown/index.tsx
  • src/pages/Admin.tsx
  • src/pages/table-list/index.tsx
  • src/pages/user/login/index.tsx
⏰ 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: build-preview
  • GitHub Check: build (20, windows-latest)
  • GitHub Check: build (20, windows-latest)
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (4)
src/pages/Admin.tsx (1)

17-30: Alert API 变更与登录页保持一致

此变更与 src/pages/user/login/index.tsx 中的 Alert API 更新保持一致(从 message 改为 title)。请确保这一变更在整个项目中得到一致应用。

src/pages/table-list/index.tsx (3)

13-13: 正确引入 FormInstance 类型

添加 FormInstance 类型导入以支持 formItemRender 的类型标注,这很好地解决了 PR 中提到的 TypeScript 类型错误。


314-322: Drawer 组件 size 属性已确认有效

在 antd v6 中,size 属性既接受预定义常量('default''large'),也接受数字值。当前使用 size={600} 是正确且有效的做法。width 属性已在 v6 中废弃,改用 size 属性是正确的做法。代码无需修改。


153-181: formItemRender 是 @ant-design/pro-components v3 的正确 API

已验证确认:formItemRender@ant-design/pro-components v3(当前项目版本 3.1.0-0)中 ProColumns 的正确 API,替代了 v2 中的 renderFormItem。参数签名 (item: ProColumns<T>, {defaultRender, ...rest}, form: FormInstance) 与官方文档一致。通过添加完整的类型标注,可修复 TS7006(参数隐含 any 类型)和 TS7031(绑定元素隐含 any 类型)等错误。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🛂 antd size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants