Skip to content

Conversation

@yoyo837
Copy link
Member

@yoyo837 yoyo837 commented Dec 2, 2025

Summary by CodeRabbit

发布说明

  • 杂务
    • 更新并调整了若干组件依赖版本,切换了表单相关组件到新的实现包以优化工具链,运行时行为保持不变。
  • 测试
    • 更新了测试相关的模拟与导入路径,新增/调整了虚拟列表的测试 mock,以保持测试稳定性。

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

@vercel
Copy link

vercel bot commented Dec 2, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
tree-select Ready Ready Preview Comment Dec 2, 2025 4:16am

@coderabbitai
Copy link

coderabbitai bot commented Dec 2, 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

将若干依赖更新并替换测试与示例中的虚拟列表 / 表单模块导入与 mock:修改 package.json 的依赖与 devDependencies,更新 examples/form.tsx 的表单导入源,调整测试 mock 路径并新增/删除相应测试 mock 文件。无导出签名变更。

Changes

内聚体 / 文件(s) 变更摘要
依赖与 devDependencies
package.json
更新依赖版本:@rc-component/select ~1.2.0 → ~1.3.0,@rc-component/tree ~1.0.1 → ~1.1.0,@rc-component/util ^1.3.0 → ^1.4.0;新增 devDependencies:@rc-component/form ^1.4.0、@rc-component/virtual-list ^1.0.1;移除 rc-field-form ^2.4.0、rc-virtual-list ^3.14.8。
示例 — 表单导入来源
examples/form.tsx
将表单相关导入从 rc-field-form 更改为 @rc-component/form(API 使用不变)。
测试 — 适配虚拟列表 hook 路径
tests/Select.spec.tsx
移除不再需要的 act 导入;将 mock 路径从 rc-virtual-list/lib/hooks/useScrollTo 更改为 @rc-component/virtual-list/lib/hooks/useScrollTo
测试 mocks — 新增 @rc-component 虚拟列表 mock
tests/__mocks__/@rc-component/virtual-list.js
新增测试 mock 文件,重导出 @rc-component/virtual-list/lib/mock 的默认导出,便于使用新包名的 mock。
测试 mocks — 移除旧默认导出
tests/__mocks__/rc-virtual-list.js
从旧的 mock 文件中删除原有的默认导出(不再 re-export List)。

Sequence Diagram(s)

(跳过 — 更改为依赖/导入与测试 mock 的替换,未引入新的跨组件顺序交互)

Estimated code review effort

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

  • 重点检查点:
    • package.json 的依赖新增/移除是否会影响构建或测试脚本(尤其从 rc-*@rc-component/* 的替换)。
    • examples/form.tsx 中从 rc-field-form 切换到 @rc-component/form 的导入是否仍兼容现有 API/类型。
    • 测试相关的 mock 文件变更:tests/__mocks__/@rc-component/virtual-list.js(新增)与 tests/__mocks__/rc-virtual-list.js(删除默认导出)是否导致测试失效;tests/Select.spec.tsx 中的 mock 路径更新是否覆盖所有引用。

Possibly related PRs

  • chore: bump tree version #633 — 修改或升级与 @rc-component/tree / rc-tree 相关的依赖与导入,和本次对 tree/select 组件依赖调整存在代码级关联。

Suggested reviewers

  • zombieJ

诗歌

🐰 版本跳跃轻轻来,
导入换路不慌张,
mock 新旧整队列,
测试与示例都就绪,
鼓掌庆祝小兔忙! 🎉

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-component/select、tree、util等包的版本升级。
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 bump-upstream

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 maintaining the project's health by updating several core dependencies to their latest minor or patch versions. This ensures the project benefits from recent bug fixes, performance enhancements, and new features provided by these upstream packages, contributing to overall stability and compatibility.

Highlights

  • Dependency Updates: Updated @rc-component/select from ~1.2.0 to ~1.3.0, @rc-component/tree from ~1.0.1 to ~1.1.0, and @rc-component/util from ^1.3.0 to ^1.4.0.
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 bumps the versions of several @rc-component dependencies. While the updates are straightforward, the pull request description is empty. It's a good practice to provide context for dependency updates, such as linking to changelogs or summarizing the changes, to help with the review process and for future reference. I've also added one suggestion to improve the consistency of version range specifiers in package.json.

Comment on lines +46 to +48
"@rc-component/select": "~1.3.0",
"@rc-component/tree": "~1.1.0",
"@rc-component/util": "^1.4.0",

Choose a reason for hiding this comment

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

medium

There's an inconsistency in the version range specifiers used for dependencies. @rc-component/select and @rc-component/tree use ~ (tilde), which restricts updates to patch releases, while @rc-component/util uses ^ (caret), allowing minor version updates.

For consistency and to fully benefit from semantic versioning, it's recommended to use ^ for all dependencies. This ensures that you receive non-breaking feature updates and bug fixes automatically.

If pinning to specific minor versions for certain packages is intentional due to stability concerns, consider adding a comment to package.json to document the reason.

Suggested change
"@rc-component/select": "~1.3.0",
"@rc-component/tree": "~1.1.0",
"@rc-component/util": "^1.4.0",
"@rc-component/select": "^1.3.0",
"@rc-component/tree": "^1.1.0",
"@rc-component/util": "^1.4.0",

@socket-security
Copy link

socket-security bot commented Dec 2, 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/​virtual-list@​1.0.1771009590100
Updated@​rc-component/​tree@​1.0.2 ⏵ 1.1.078 +110010093 +3100
Updated@​rc-component/​select@​1.2.4 ⏵ 1.3.08510010098 +1100
Added@​rc-component/​form@​1.4.08510010090100

View full report

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)
package.json (1)

46-48: 补充 PR 说明文档,说明版本更新的目的和破坏性变更。

建议为此 PR 添加详细说明,包括:

  1. 更新这些版本的原因(功能改进、安全修复等)
  2. 是否存在破坏性变更(breaking changes)需要代码调整
  3. 相关的更新日志链接(CHANGELOG 或发布说明)
  4. 是否需要对现有代码进行迁移调整

这样可以帮助审阅者理解变更的影响范围,以及是否需要配合其他代码更改。

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9afde7d and f24ec07.

📒 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). (1)
  • GitHub Check: Socket Security: Pull Request Alerts
🔇 Additional comments (1)
package.json (1)

46-48: Verify compatibility and testing for upstream dependency updates.

The three @rc-component minor version bumps (@rc-component/[email protected], @rc-component/[email protected], @rc-component/[email protected]) all exist on npm. Before merging:

  • Confirm CI/CD tests pass with these new versions
  • Document any breaking changes or API adjustments needed (if applicable)
  • Check for any peer dependency conflicts

@codecov
Copy link

codecov bot commented Dec 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.83%. Comparing base (9afde7d) to head (bfbc4ed).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #655   +/-   ##
=======================================
  Coverage   99.83%   99.83%           
=======================================
  Files          17       17           
  Lines         619      619           
  Branches      190      190           
=======================================
  Hits          618      618           
  Misses          1        1           

☔ 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: 2

♻️ Duplicate comments (1)
package.json (1)

46-48: 版本范围说明符的不一致性仍然存在。

与之前的审查意见一致,依赖项使用了不同的版本范围说明符:

  • @rc-component/select@rc-component/tree 使用 ~(波浪号),限制为补丁版本更新
  • @rc-component/util 使用 ^(插入符号),允许次要版本更新

建议对所有依赖项统一使用 ^ 以保持一致性并充分利用语义化版本控制。如果为特定包固定次要版本是出于稳定性考虑,建议在 package.json 中添加注释说明原因。

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f24ec07 and bfbc4ed.

📒 Files selected for processing (5)
  • examples/form.tsx (1 hunks)
  • package.json (1 hunks)
  • tests/Select.spec.tsx (2 hunks)
  • tests/__mocks__/@rc-component/virtual-list.js (1 hunks)
  • tests/__mocks__/rc-virtual-list.js (0 hunks)
💤 Files with no reviewable changes (1)
  • tests/mocks/rc-virtual-list.js
🔇 Additional comments (3)
tests/Select.spec.tsx (2)

12-15: LGTM!Mock 路径更新正确。

将 mock 路径从 rc-virtual-list/lib/hooks/useScrollTo 更新为 @rc-component/virtual-list/lib/hooks/useScrollTo 与 package.json 中的依赖变更保持一致。


1-1: Remove unused act import from @testing-library/react.

The act function is not used anywhere in this test file and can be safely removed.

package.json (1)

54-54: All newly added package versions are available on npm registry.

@rc-component/form@^1.4.0, @rc-component/virtual-list@^1.0.1, and other mentioned @rc-component packages (select, tree, util) all exist on npm and are compatible for installation.

import React, { Component } from 'react';
import Select from '@rc-component/select';
import Form, { useForm, Field } from 'rc-field-form';
import Form, { useForm, Field } from '@rc-component/form';
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

🌐 Web query:

@rc-component/form package npm API Form useForm Field

💡 Result:

Short summary of the @rc-component/form (rc-field-form) API — Form, Form.useForm, Field

  • Import:
    import Form, { Field } from 'rc-field-form'. [1][2]

  • Form (props)

    • form: FormInstance (pass instance returned by Form.useForm()).
    • initialValues: object.
    • name: string (FormProvider name).
    • preserve: boolean (preserve removed field values).
    • validateMessages: templates for validator messages.
    • onValuesChange(changedValues, allValues).
    • onFieldsChange(changedFields, allFields).
    • onFinish(values) — called on successful submit.
    • onFinishFailed({ values, errorFields, outOfDate }).
    • component, fields (controlled fields list), valuePropName, etc. [1][2]
  • Form.useForm / Form instance (methods)

    • const [form] = Form.useForm(); pass to . [1][2]
    • Common instance methods: getFieldValue(name), getFieldsValue([nameList]), setFieldsValue(values), getFieldError(name), validateFields([names]), resetFields([names]), submit(), setFields([...]) — (see type defs in repo). [1][2]
  • Field (props / usage)

    • children.
    • Rules support typical validation rule options (required, pattern, type, min, max, len, enum, message, validator).
    • Field registers with Form and maps child input value via valuePropName (default "value"). [1][2]

References / docs:

  • npm package page (@rc-component/form / rc-field-form) — API table and examples. [1]
  • GitHub repository (react-component/field-form) — README and TypeScript interfaces (detailed types/methods). [2]

If you want, I can paste the most-used Form instance method signatures from the repo's TypeScript interfaces.


🌐 Web query:

@rc-component/form useForm named export import destructure

💡 Result:

Short answer: there isn’t a separate named export called useForm to destructure — call the static method on the Form default export (Form.useForm).

Examples:

  • import and call the static method:
    import Form from 'rc-field-form';
    const [form] = Form.useForm();
    return ...;. [1][2]

  • if you prefer destructuring-like syntax for methods returned from the instance:
    const [form] = Form.useForm();
    const { getFieldValue, setFieldsValue } = form;
    // use getFieldValue / setFieldsValue in your component. [1][2]

Sources: rc-field-form docs / package README. [1][2]


🏁 Script executed:

cat examples/form.tsx

Repository: react-component/tree-select

Length of output: 3905


Fix incorrect import pattern—useForm is not a named export.

The import import Form, { useForm, Field } from '@rc-component/form' will fail because useForm is a static method on Form, not a named export. Line 47 will throw a runtime error.

Change to:

import Form, { Field } from '@rc-component/form';

And update line 47 from const [form] = useForm(); to const [form] = Form.useForm();

🤖 Prompt for AI Agents
In examples/form.tsx around line 3 (and affecting line 47), the import is wrong:
useForm is not a named export from '@rc-component/form' but a static method on
Form; update the import to only bring in Form and Field (remove useForm from the
named imports) and change the form initialization on line 47 from calling
useForm() to calling Form.useForm() so the code uses the static method
correctly.

Comment on lines +1 to +3
import List from '@rc-component/virtual-list/lib/mock';

export default List;
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:

cd /tmp && find . -name "package.json" -type f | head -5 && cat package.json 2>/dev/null | grep -A5 -B5 "@rc-component/virtual-list" || echo "Searching from repo root..."

Repository: react-component/tree-select

Length of output: 120


🏁 Script executed:

git ls-files | grep -E "package\.json$"

Repository: react-component/tree-select

Length of output: 83


🏁 Script executed:

cat package.json | grep -A 2 -B 2 "@rc-component/virtual-list"

Repository: react-component/tree-select

Length of output: 259


🏁 Script executed:

# Search for usage of the mock in test files
rg "from.*virtual-list" tests/ --type js --type jsx --type ts --type tsx

Repository: react-component/tree-select

Length of output: 98


🏁 Script executed:

rg "virtual-list" tests/ --type js --type ts

Repository: react-component/tree-select

Length of output: 364


🏁 Script executed:

# Search for mock usage more broadly
rg "/@rc-component/virtual-list" . --type js --type ts

Repository: react-component/tree-select

Length of output: 53


🏁 Script executed:

# Check if there are any jest config references to this mock
cat jest.config.js 2>/dev/null || cat jest.config.ts 2>/dev/null || echo "No jest config found"

Repository: react-component/tree-select

Length of output: 199


🏁 Script executed:

# Search for moduleNameMapper or mock-related config
rg "moduleNameMapper|virtual-list" . --type js --type json

Repository: react-component/tree-select

Length of output: 233


🌐 Web query:

@rc-component/virtual-list lib/mock export npm package

💡 Result:

Do you mean whether the path "@rc-component/virtual-list/lib/mock" is published/officially exported by the rc-virtual-list npm package?

Short answer: No—rc-virtual-list publishes its built files under lib/ (the package entry points are the package's main/exports), but there is no documented or supported public export named "lib/mock" in the package. Confirmed by the package repository and npm listing (see package repo and npm page). [1][2]

If you need a mock helper from that repo, either:

  • look for test/mock code in the GitHub repo and copy/port it into your project, or
  • open an issue/PR on the repo asking the maintainers to export a supported mock helper.

Sources:

  1. GitHub repository file listing for react-component/virtual-list. [1]
  2. rc-virtual-list package on npm. [2]

🌐 Web query:

@rc-component/virtual-list 1.0.1 package structure exports

💡 Result:

I couldn't find a package published as "@rc-component/virtual-list" at version 1.0.1. The project is published on npm as rc-virtual-list (unscoped); its package.json on npm/GitHub shows main/module entries (e.g. main: "./lib/index", module: "./es/index") and the repository is react-component/virtual-list. See npm and GitHub for the published package.json and repo: [1][2].

If you specifically need the exports/structure for a particular published tarball (e.g. a 1.0.1 release), tell me where that version is published (npm package name or a tarball/commit link) and I’ll fetch the package.json/files and list the exports precisely.

Sources:
[1] rc-virtual-list on npm — package page and versions.
[2] react-component/virtual-list repository on GitHub.


The mock import path is incorrect and will cause runtime failures.

@rc-component/virtual-list/lib/mock is not a documented or supported export from the @rc-component/virtual-list package. The package only publishes main/module entries (lib/index, es/index) without a mock export. Either:

  • Check the package repository for test/mock utilities to port into this project, or
  • Open an issue with @rc-component/virtual-list maintainers to export a mock helper
🤖 Prompt for AI Agents
In tests/__mocks__/@rc-component/virtual-list.js lines 1-3, the file imports
from a non-exported path '@rc-component/virtual-list/lib/mock' which will fail
at runtime; replace this with a supported approach by either (A) creating a
local mock implementation that exports the same API your tests expect (copy/port
the upstream mock utilities into this repo under tests/__mocks__ and export them
here), or (B) import from the package's published entrypoint and wrap/spy the
real module where possible (e.g., require('@rc-component/virtual-list') and
re-export only the functions/components you need). If you cannot port a mock,
open an issue with the upstream maintainers requesting a published mock export.
Ensure the new mock matches the public API used in tests and update any tests
that depend on internal implementation details.

@afc163 afc163 merged commit 6511676 into master Dec 2, 2025
13 checks passed
@afc163 afc163 deleted the bump-upstream branch December 2, 2025 04:27
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