Skip to content

chore: support antd 6#51

Merged
afc163 merged 10 commits intomasterfrom
antd-update
Dec 11, 2025
Merged

chore: support antd 6#51
afc163 merged 10 commits intomasterfrom
antd-update

Conversation

@li-jia-nan
Copy link
Copy Markdown
Member

@li-jia-nan li-jia-nan commented Dec 9, 2025

Summary by CodeRabbit

发布说明

  • 重构
    • 升级并替换若干底层依赖以对齐 Ant Design v6 与 React 18,优化提供者与渲染相关实现与行为。
    • 更新发布脚本与构建插件以改进打包流程。
  • Tests
    • 调整测试工具导入路径并移除与不稳定渲染相关的测试用例。
  • Docs
    • 优化示例组件结构,增强示例中标签的交互与类型声明。
  • Style
    • 调整视觉效果样式与动效实现细节以提升表现一致性。
  • Chores
    • 将锁文件加入忽略列表。

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

Copilot AI review requested due to automatic review settings December 9, 2025 02:41
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 9, 2025

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

Walkthrough

升级依赖以兼容 antd v6,替换若干内部/第三方库(如 classnames→clsx、rc-→@rc-component/、TinyColor→FastColor),删除内部工具 unstable-render 及其测试,调整 HappyProvider 与 DotEffect 的实现与样式导出,更新测试与示例导入。

Changes

内聚 / 文件(s) 变更摘要
依赖与清单
\package.json`, `.gitignore``
升级/替换依赖(classnamesclsx@ant-design/cssinjs 升级,添加 @ant-design/fast-colorrc-* 替换为 @rc-component/* 等),更新 peer/react/TypeScript 版本要求,向 .gitignore 添加 pnpm-lock.yaml
视觉/效果组件(实现与样式)
DotEffect
\src/DotEffect/index.tsx`, `src/DotEffect/style.ts``
@ant-design/fast-color 替换 TinyColor、用 clsx 替换 classNames,motion/raf 导入切换到 @rc-component/*,样式导出由函数改为 const useStyle 并默认导出,微调 z-indextransform(使用 translate3d)
Provider 渲染与类型调整
\src/HappyProvider.tsx``
HappyProvider 改为 constReact.FC<PropsWithChildren>,用 @rc-component/utilrender/unmount 替代原 unstableRender,卸载后移除 holder,使用 useMemo 缓存 wave 配置,调整导出与返回对象
移除不再需要的工具与测试
\src/_utils/unstable-render.tsx`, `tests/unstable-render.test.tsx``
完整删除 unstable-render 实现与其导出(如 _canunstableRender)以及对应测试文件
测试导入适配
\tests/index.test.tsx``
测试工具导入路径从 rc-util/lib/test/domHook 改为 @rc-component/util/lib/test/domHook
示例与文档微调
\docs/examples/theme.tsx``
示例组件声明改为 React.FC,将内联样式替换为共享样式常量,示例中 Tag 使用添加了 variant/color/style/onClick 等 props

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 分钟

  • 建议重点复核:
    • src/HappyProvider.tsx:render/unmount 的调用顺序、holder 移除逻辑、useMemo 依赖与类型一致性。
    • 确认代码库中已替换或移除所有对被删除 src/_utils/unstable-render.tsx 的引用,避免残留导入导致构建失败。
    • src/DotEffect/index.tsxsrc/DotEffect/style.ts:FastColor 的 HSV/HSL 行为与原 TinyColor 等价性,以及 zIndex/transform 对视觉影响。
    • package.json 中 peer/dev 版本提升对 CI 与下游兼容性的影响(尤其 antd 与 React/TypeScript 版本)。

Poem

🐰 我在代码林间跳舞,轻盈换了新布,
clsx 摆尾替旧名,色彩用上 FastColor 的光芒,
卸载旧渲染,移去旧足迹,测试路径也随风迁移,
小标签点一下就笑,包裹里藏着新依赖与新意 🌿

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR标题"chore: support antd 6"清晰准确地反映了变更的主要内容,即升级项目以支持Ant Design v6。
Linked Issues check ✅ Passed 代码变更完整实现了升级Ant Design v6及所有依赖的要求,包括更新包版本、替换库依赖、调整代码使用和移除废弃API。
Out of Scope Changes check ✅ Passed 所有变更都与升级Ant Design v6及其依赖直接相关,包括库替换(TinyColor→FastColor、classnames→clsx等)、依赖版本更新和相应代码调整,无跨界变更。
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch antd-update

📜 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 a47e670 and 7bb4f2e.

📒 Files selected for processing (1)
  • package.json (1 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). (3)
  • GitHub Check: compile
  • GitHub Check: coverage
  • GitHub Check: lint
🔇 Additional comments (4)
package.json (4)

34-34: 构建脚本更新正确,已包含所需依赖。

使用 rc-np 代替 np,与第48行的 @rc-component/np 版本依赖相符。


39-44: 依赖迁移与 antd 6 生态兼容。

依赖关系更新反映了从 rc-* 包到 @rc-component/* 的生态迁移,以及相关工具库的替换(classnames → clsx,TinyColor → FastColor)。这与代码中其他文件的改动(DotEffect、HappyProvider 等)保持一致。


47-48: 开发依赖版本更新与构建工具链一致。

  • @rc-component/father-plugin 升级至 ^2.0.0 以支持新的构建流程
  • @rc-component/np ^1.0.4 用于 rc-np 命令(第34行)
  • typescript ^5.0.0 与现代化工具链对齐
  • antd ^6.1.0 用于本地开发和测试

Also applies to: 52-52, 55-55, 65-65


68-70: React 18 requirement is driven by antd 6.1.0 dependency, not React 18-specific features.

This is a breaking change requiring major version bump per semver, but the reasoning needs correction. The React >=18.0.0 constraint is inherited from antd 6.1.0, which itself requires React 18+. The HappyProvider code itself does not use React 18-specific APIs (e.g., useTransition, useDeferredValue, useId). It uses only standard React Hooks (useState, useEffect, useMemo) that exist across React versions 16+. The recent React 19 compatibility changes further confirm the code is designed to work across multiple React versions through abstraction layers.

Likely an incorrect or invalid review 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.

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @li-jia-nan, 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 significant upgrade to ensure compatibility with Ant Design 6. It involves updating core dependencies to their latest versions within the @rc-component ecosystem, optimizing class name handling, and standardizing React rendering mechanisms. These changes are crucial for maintaining an up-to-date and performant codebase that aligns with the latest Ant Design framework.

Highlights

  • Ant Design 6 Support: The project has been updated to support Ant Design version 6, with antd now listed as a direct dependency and removed from peer dependencies.
  • Dependency Migration to @rc-component: Key internal dependencies such as rc-motion and rc-util have been migrated to their modern, scoped counterparts: @rc-component/motion and @rc-component/util.
  • Classname Utility Update: The classnames library has been replaced with clsx for more efficient and streamlined management of CSS classes.
  • Simplified React Rendering: The custom _utils/unstable-render.tsx utility has been removed, and its functionality replaced by the standard render and unmount functions provided by @rc-component/util/lib/React/render.
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
Copy Markdown

@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 the project to support Ant Design v6. The changes primarily involve updating dependencies in package.json, including replacing rc-motion and rc-util with their new scoped packages @rc-component/motion and @rc-component/util, and classnames with clsx. The code has been updated to use the new dependencies, and a custom unstableRender utility has been removed in favor of the render function from @rc-component/util.

My main feedback is regarding how antd is handled as a dependency. For a theme library like this, it should be a peerDependency rather than a direct dependency to avoid version conflicts in consumer applications. I have provided specific suggestions to adjust package.json accordingly.

Comment thread package.json
Comment thread package.json
Comment thread package.json
Copy link
Copy Markdown

Copilot AI left a 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 upgrades the project to support Ant Design 6 by updating dependencies from the legacy rc-* packages to the newer @rc-component/* scoped packages, replacing classnames with clsx, and removing the custom unstable-render utility that was needed for antd 5 compatibility. The changes modernize the codebase to align with antd 6's dependency ecosystem while simplifying the rendering logic.

Key changes:

  • Migrated from rc-util, rc-motion, and classnames to @rc-component/util, @rc-component/motion, and clsx
  • Removed custom unstable-render utility and its associated version-specific workarounds for antd 5
  • Refactored HappyProvider to use React.FC<React.PropsWithChildren<>> pattern and simplified render/unmount calls

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
package.json Updated dependencies to antd 6 ecosystem (@rc-component packages, clsx), moved antd from peerDependencies to dependencies
src/HappyProvider.tsx Refactored to use direct render/unmount from @rc-component/util, updated to React.FC pattern with PropsWithChildren
src/DotEffect/index.tsx Migrated from classnames to clsx and updated motion/util imports to @rc-component packages
src/_utils/unstable-render.tsx Removed (no longer needed with antd 6)
tests/unstable-render.test.tsx Removed (tests for deleted utility)
tests/index.test.tsx Updated import from rc-util to @rc-component/util
.gitignore Added pnpm-lock.yaml to ignored files

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread package.json Outdated
Comment thread package.json
Copy link
Copy Markdown

@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: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e4d01d2 and e167c83.

📒 Files selected for processing (7)
  • .gitignore (1 hunks)
  • package.json (1 hunks)
  • src/DotEffect/index.tsx (4 hunks)
  • src/HappyProvider.tsx (4 hunks)
  • src/_utils/unstable-render.tsx (0 hunks)
  • tests/index.test.tsx (1 hunks)
  • tests/unstable-render.test.tsx (0 hunks)
💤 Files with no reviewable changes (2)
  • tests/unstable-render.test.tsx
  • src/_utils/unstable-render.tsx
🧰 Additional context used
🧬 Code graph analysis (1)
src/HappyProvider.tsx (2)
src/index.tsx (1)
  • HappyProvider (3-3)
src/DotEffect/index.tsx (1)
  • DotEffect (42-252)
⏰ 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). (3)
  • GitHub Check: Agent
  • GitHub Check: Socket Security: Pull Request Alerts
  • GitHub Check: setup
🔇 Additional comments (11)
.gitignore (1)

30-30: LGTM!

添加 pnpm-lock.yaml 到忽略列表符合最佳实践,与项目的依赖迁移保持一致。

src/DotEffect/index.tsx (3)

3-5: LGTM! 依赖迁移正确。

已正确将依赖从旧的 rc-* 包迁移到新的 @rc-component/* 包:

  • classnamesclsx(更轻量的替代方案)
  • rc-motion@rc-component/motion
  • rc-util/lib/raf@rc-component/util/lib/raf

203-203: LGTM! clsx 使用正确。

正确使用 clsx 替换了原来的 classNames 来组合 CSS 类名。


225-225: LGTM! clsx 使用正确。

正确使用 clsx 来组合动画类名。

src/HappyProvider.tsx (5)

2-2: LGTM! 导入路径更新正确。

useEvent 的导入路径已从 rc-util 更新为 @rc-component/util,与整体迁移保持一致。


5-5: LGTM! 渲染工具导入更新正确。

@rc-component/util/lib/React/render 导入 renderunmount,替换了之前的 unstableRender,这是一个更稳定的 API。


17-19: LGTM! 组件类型定义重构合理。

将组件重构为 React.FC<React.PropsWithChildren<HappyProviderProps>> 是现代 React 的推荐做法,PropsWithChildren 自动提供 children 类型,无需在 props 接口中显式声明。


32-44: LGTM! 新的 render/unmount API 使用正确。

正确使用了新的 renderunmount API:

  • render(element, holder) 替代了之前的 unstableRender
  • unmount(holder) 返回 Promise,正确使用 .then() 等待卸载完成后再移除 holder 元素
  • 这种方式确保了清理操作的正确顺序,避免了潜在的内存泄漏

58-60: LGTM! 导出模式更新正确。

导出模式从函数声明改为先定义常量再默认导出,与 React.FC 模式配合良好,保持了公共 API 的一致性。

package.json (2)

42-45: The review comment is based on incorrect information about the code state.

The actual package.json at lines 42-45 contains @rc-component/motion, @rc-component/util, and clsx—not antd. The antd package is listed in devDependencies (line 54), not in the dependencies section. Additionally, antd is not present in peerDependencies and has never been moved from peerDependency to dependency based on the current file state.

The architectural concerns about breaking changes and version conflicts are based on a false premise about what changed in the code. Please verify the actual changes being reviewed.

Likely an incorrect or invalid review comment.


52-52: Remove @types/node from devDependencies — it is not needed for this React component library.

This is a browser-based React component library with no Node.js runtime dependencies. The source code in src/ contains no usage of Node.js types, the build tools (dumi, father) and testing framework (rc-test) do not require @types/node, and it is not currently installed. Configuration files like .dumirc.ts import Node.js modules, but TypeScript resolves these without needing the types package in this project setup. This dependency should be removed.

Likely an incorrect or invalid review comment.

Comment thread tests/index.test.tsx
Comment thread package.json
Comment thread package.json Outdated
Comment thread package.json Outdated
Comment thread package.json
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread package.json Outdated
Copy link
Copy Markdown

@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: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7659c49 and 060103d.

📒 Files selected for processing (1)
  • src/HappyProvider.tsx (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/HappyProvider.tsx (2)
src/index.tsx (1)
  • HappyProvider (3-3)
src/DotEffect/index.tsx (1)
  • DotEffect (42-252)
🔇 Additional comments (4)
src/HappyProvider.tsx (4)

17-19: 很好的重构!

将组件重构为 React.FC<React.PropsWithChildren<HappyProviderProps>> 是符合 React 18 最佳实践的做法,children 现在通过 PropsWithChildren 隐式提供,提高了类型安全性。


47-52: 通过 memoization 优化性能。

引入 React.useMemo 避免不必要的 wave 配置重建。依赖数组 [disabled] 是正确的,因为 showEffect 通过 useEvent 创建,保证了引用稳定性。


54-57: LGTM!

返回语句正确使用了 memoizedWaveConfig,导出方式符合重构后的组件定义。


32-32: Migrate from unstableRender to stable render API.

Updated to use the stable render API from @rc-component/util/lib/React/render. The Promise-based cleanup is correct—unmount(holder) returns a Promise, allowing proper async sequencing: component is unmounted first, then the DOM node is removed.

Comment thread src/HappyProvider.tsx
Copy link
Copy Markdown

@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 (2)
docs/examples/theme.tsx (2)

23-29: 抽离容器样式为常量,结构更清晰

将外层容器样式提取成 style 常量提升了复用性和可读性,类型上用 React.CSSProperties 也没问题。可以视情况考虑改名为 wrapperStyle 或类似更语义化的名字,但不是必须。


76-83: Tag 示例更贴近日常用法,但可以避免空的 onClick

Tag 增加 variant="outlined"color="blue"userSelect: 'none' 能更好展示交互样式,这里设计上 OK。唯一小建议是当前 onClick={() => {}} 是空实现,如果没有真正交互需求,可以删除 onClick,或简单 console.log 一下点击事件,否则有可能被某些 ESLint 规则视为无意义空函数。

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 060103d and d4637df.

📒 Files selected for processing (2)
  • docs/examples/theme.tsx (4 hunks)
  • src/DotEffect/style.ts (3 hunks)
🔇 Additional comments (7)
src/DotEffect/style.ts (4)

56-60: 代码重构良好!

sharedConfig 提取为公共配置对象是一个很好的 DRY 改进,减少了代码重复,提高了可维护性。


82-82: 确认 zIndex 大幅提升的必要性。

zIndex999 提升到 999999 是一个较大的变化。这可能是为了确保点击波纹效果能够显示在 Modal、Drawer 等高层级组件之上(它们通常使用 1000+ 的 z-index)。

请确认这是为了适配 antd 6 的需要,且不会与其他使用超高 z-index 的组件产生冲突。

Also applies to: 92-92


89-89: 性能优化良好!

使用 translate3d 代替 translate 可以触发 GPU 硬件加速,这对于动画效果的流畅度有明显提升。


108-110: 导出方式调整合理。

将函数赋值给命名常量后再导出,便于调试时在堆栈跟踪中看到函数名称,同时保持了公共接口不变。

docs/examples/theme.tsx (3)

3-13: 导入 version 展示 antd 版本信息是合理的用法

这里仅用于在示例中展示当前 antd 版本,没有引入额外逻辑复杂度,看起来没问题。


31-36: 将 Demo 显式声明为 React.FC 有利于类型检查

Demo 声明为 React.FC 可以让返回 JSX 的意图更明确,也有助于 TS 推断 children 等类型,这里改动是正向的。


52-53: ConfigProvider 包裹 + 抽离样式的写法更简洁

ConfigProvider theme={{ token }} 配合外层 <div style={style}> 让 JSX 层级更清晰,也避免在 JSX 中出现大块内联样式,整体结构不错。

Comment thread package.json Outdated
Co-authored-by: Amumu <yoyo837@hotmail.com>
Comment thread package.json Outdated
Comment thread package.json Outdated
@socket-security
Copy link
Copy Markdown

socket-security Bot commented Dec 10, 2025

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

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​rc-component/​np@​1.0.4721006985100
Updated@​rc-component/​father-plugin@​1.1.0 ⏵ 2.1.379 -110079 +289 +2100
Updatedtypescript@​4.9.5 ⏵ 5.9.31001009010090

View full report

Comment thread package.json
Comment thread package.json Outdated
@li-jia-nan li-jia-nan requested review from afc163 and yoyo837 December 10, 2025 18:37
@afc163 afc163 merged commit 126fa88 into master Dec 11, 2025
8 checks passed
@afc163 afc163 deleted the antd-update branch December 11, 2025 01:54
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.

升级所有依赖,兼容 antd v6

6 participants