refactor: rename onPopupVisibleChange to onOpenChange across components
- ref https://github.com/react-component/trigger/pull/522
- ref https://github.com/react-component/trigger/pull/523
Summary by CodeRabbit
-
重构
- 统一了下拉选择组件的状态回调命名,提升了 API 一致性和可读性,且所有组件的表现保持不变。
-
文档
- 更新了
.gitignore文件,添加了.history和pnpm-lock.yaml条目。
- 更新了
-
依赖
- 重新添加了依赖
@rc-component/trigger,并新增了开发依赖@types/node。
- 重新添加了依赖
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| select | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Apr 7, 2025 7:50am |
Walkthrough
本次更改主要在代码中统一了事件处理方法的名称,将原来的 onPopupVisibleChange 重命名为 onOpenChange。此修改在多个组件(如 Controlled、BaseSelect、SelectTrigger)以及相关测试文件中均已同步更新。功能和控制逻辑保持不变,修改仅涉及命名更新。
Changes
| 文件 | 修改摘要 |
|---|---|
docs/.../controlled.tsx |
在 Controlled 组件中将方法 onPopupVisibleChange 重命名为 onOpenChange,同时更新了组件内所有相关引用。 |
src/BaseSelect/index.tsx, src/SelectTrigger.tsx |
在 BaseSelectProps 接口及 SelectTrigger 组件中,将属性 onPopupVisibleChange 重命名为 onOpenChange,并更新了所有使用该属性的地方。 |
tests/.../Combobox.test.tsx, tests/.../Custom.test.tsx, tests/.../Popup.test.tsx, tests/.../Select.test.tsx |
在各测试文件中统一将事件回调变量从 onPopupVisibleChange 改为 onOpenChange,并更新了相应的断言和测试逻辑。 |
Possibly related PRs
-
react-component/select#1103: 该 PR 涉及将
onDropdownVisibleChange替换为onPopupVisibleChange,反映出代码库中一致的重命名模式。 -
react-component/select#1113: 该 PR 更新了
BaseSelect组件中的onPopupVisibleChange方法名,与本次改动直接相关。 -
react-component/select#1126: 该 PR 更新了
BaseSelectProps接口中的onPopupVisibleChange方法名,与本次改动直接相关。
Suggested reviewers
- zombieJ
Poem
我是一只活泼的小兔子,
跳跃在代码的草丛间,
旧名悄然变成新名,
onOpenChange闪亮登场 😊,
代码简洁,心中欢畅!
📜 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 f89406f93b277c40ed9957766a2d6b63f4029a22 and 3827425a126c6abfd08af817caf4f7b548172bf5.
📒 Files selected for processing (2)
-
.gitignore(1 hunks) -
package.json(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- .gitignore
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Analyze (javascript)
🔇 Additional comments (2)
package.json (2)
53-53: 重新添加依赖项 "@rc-component/trigger" 的说明这部分更改重新添加了依赖项
@rc-component/trigger并指定了版本^3.0.0。请确认此版本满足组件功能需求,同时检查与其他组件的兼容性,确保没有引入安全或功能问题。
65-65: 新增开发依赖项 "@types/node" 的说明这部分更改在 devDependencies 中添加了
@types/node,版本设为^22.14.0。此依赖项有助于在 TypeScript 项目中提供 Node.js 的类型定义。请确保团队已验证此版本与项目中其他开发工具的兼容性。
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
-
I pushed a fix in commit <commit_id>, please review it. -
Generate unit testing code for this file. -
Open a follow-up GitHub issue for this discussion.
-
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:-
@coderabbitai generate unit testing code for this file. -
@coderabbitai modularize this function.
-
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:-
@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase. -
@coderabbitai read src/utils.ts and generate unit testing code. -
@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format. -
@coderabbitai help me debug CodeRabbit configuration file.
-
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
-
@coderabbitai pauseto pause the reviews on a PR. -
@coderabbitai resumeto resume the paused reviews. -
@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository. -
@coderabbitai full reviewto do a full review from scratch and review all the files again. -
@coderabbitai summaryto regenerate the summary of the PR. -
@coderabbitai generate docstringsto generate docstrings for this PR. -
@coderabbitai resolveresolve all the CodeRabbit review comments. -
@coderabbitai planto trigger planning for file edits and PR creation. -
@coderabbitai configurationto show the current CodeRabbit configuration for the repository. -
@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 98.26%. Comparing base (
3639a8a) to head (79d23af).
Additional details and impacted files
@@ Coverage Diff @@
## master #1136 +/- ##
=======================================
Coverage 98.26% 98.26%
=======================================
Files 39 39
Lines 1500 1500
Branches 453 453
=======================================
Hits 1474 1474
Misses 26 26
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.