-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(): update React 19 #1477
base: master
Are you sure you want to change the base?
feat(): update React 19 #1477
Conversation
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 概述代码变更总览本次代码变更主要涉及以下几个关键方面:
详细变更代码变更
主要影响
建议
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1477 +/- ##
==========================================
- Coverage 90.47% 90.40% -0.08%
==========================================
Files 124 124
Lines 2762 2762
Branches 379 379
==========================================
- Hits 2499 2497 -2
- Misses 169 172 +3
+ Partials 94 93 -1
|
🚀 Deployed on https://docs-preview-1477--next-bricks.netlify.app |
There was a problem hiding this 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 (10)
bricks/basic/src/menu-group/index.spec.tsx (1)
2-2
: 更新了 React 测试工具的导入路径此更改符合 React 19 的最新实践。建议增加以下测试场景:
- 组件禁用状态的测试
- 不同尺寸配置的测试
- 自定义样式的测试
bricks/basic/src/editors/eo-descriptions/index.tsx (1)
18-18
: React 19 中的 ref 初始化优化!使用
undefined
显式初始化dataListRef
是一个好的改进:
- 符合 React 19 中对 ref 初始化的最佳实践
- 提高了代码的可预测性
- 避免了潜在的未定义行为
建议在项目中的其他 ref 初始化也采用类似的显式方式。
bricks/basic/src/data-providers/show-watermark/show-watermark.spec.tsx (1)
1-4
: 删除注释掉的旧导入语句建议删除注释掉的旧导入语句,以避免混淆。保留从 React 19 新位置导入的
act
。-// import { act } from "react"; import { showWaterMark } from "./show-watermark.js"; import "jest-canvas-mock"; import { act } from "react";
bricks/basic/src/sidebar/sidebar-menu-group/index.spec.tsx (1)
Line range hint
39-44
: 优化异步 act 的使用方式当前的嵌套 await 结构可以简化。在 React 19 中,可以更简洁地处理异步操作。
- await act(async () => { - await ( - element.shadowRoot?.querySelector(".menu-group-title") as HTMLElement - ).click(); - }); + await act(() => { + (element.shadowRoot?.querySelector(".menu-group-title") as HTMLElement).click(); + });bricks/basic/src/breadcrumb/index.spec.tsx (1)
2-2
: 导入更改正确,测试覆盖全面!此更改完成了向 React 19 的迁移。文件中同步和异步
act()
的使用都很恰当,展示了良好的测试实践。建议:
- 考虑在项目的 README 或升级指南中记录这个改动
- 确保团队所有成员都了解这个变更
bricks/basic/src/image/hooks/useTransform.spec.ts (1)
2-2
: 导入更改符合 React 19 最佳实践这些更改反映了 React 19 中的架构变化:
- 使用
it
替代test
是一个好的实践- 从 React 核心包导入
act
符合新版本的推荐做法建议在其他测试文件中也采用这种导入方式,以保持一致性。
Also applies to: 4-4
bricks/basic/src/image/ImageList.spec.tsx (1)
3-3
: 测试工具导入优化
- 移除未使用的
screen
导入提高了代码整洁度- 将
act
的导入源从react-dom/test-utils
改为react
符合 React 19 的最新实践建议检查是否可以使用
screen
提供的查询方法来替代直接的 DOM 查询,这样可以提高测试的可维护性。Also applies to: 5-5
bricks/basic/src/sidebar/sidebar-menu-submenu/index.spec.tsx (1)
3-3
: 异步测试最佳实践
- 将
act
导入源更改为react
符合 React 19 的要求- 测试中正确使用了
async act
,这是处理异步更新的最佳实践建议在其他包含异步操作的测试中也采用类似的
async act
模式。bricks/basic/src/dropdown-actions/index.spec.tsx (1)
Line range hint
1-115
: 建议优化测试覆盖率当前测试用例主要覆盖了基本用法,建议添加以下场景的测试:
- 错误处理
- 边界条件
- 并发操作
这对于确保在 React 19 的并发特性下组件的稳定性很重要。
bricks/basic/src/loading-container/index.spec.tsx (1)
Line range hint
1-142
: 建议增强延迟加载测试考虑到 React 19 的并发特性,建议增加以下测试场景:
- 快速切换 loading 状态
- 并发更新时的延迟行为
- 在 Suspense 边界内的行为
这将确保组件在新的并发环境中正常工作。
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
yarn.lock
is excluded by!**/yarn.lock
,!**/*.lock
📒 Files selected for processing (63)
bricks/basic/package.json
(1 hunks)bricks/basic/src/actions/index.spec.tsx
(1 hunks)bricks/basic/src/app-bar-wrapper/index.spec.tsx
(1 hunks)bricks/basic/src/avatar-group/index.spec.tsx
(1 hunks)bricks/basic/src/avatar/index.spec.tsx
(1 hunks)bricks/basic/src/breadcrumb-item/index.spec.tsx
(1 hunks)bricks/basic/src/breadcrumb/index.spec.tsx
(1 hunks)bricks/basic/src/broadcast-channel/index.spec.tsx
(1 hunks)bricks/basic/src/broadcast-channel/index.tsx
(1 hunks)bricks/basic/src/button/index.spec.ts
(1 hunks)bricks/basic/src/context-menu/index.spec.tsx
(1 hunks)bricks/basic/src/counter-badge/index.spec.tsx
(1 hunks)bricks/basic/src/data-providers/show-notification/show-notification.spec.tsx
(1 hunks)bricks/basic/src/data-providers/show-watermark/show-watermark.spec.tsx
(1 hunks)bricks/basic/src/dropdown-actions/index.spec.tsx
(1 hunks)bricks/basic/src/dropdown-button/index.spec.ts
(1 hunks)bricks/basic/src/dropdown-select/index.spec.tsx
(1 hunks)bricks/basic/src/easyops-avatar/index.spec.tsx
(1 hunks)bricks/basic/src/easyops-avatar/useUserInfoByNameOrInstanceId.spec.tsx
(1 hunks)bricks/basic/src/editors/eo-descriptions/index.tsx
(1 hunks)bricks/basic/src/editors/eo-next-table/index.tsx
(1 hunks)bricks/basic/src/event-agent/index.spec.ts
(1 hunks)bricks/basic/src/formatter-number/index.spec.tsx
(1 hunks)bricks/basic/src/frame-breadcrumb/index.spec.tsx
(1 hunks)bricks/basic/src/iframe/index.spec.tsx
(1 hunks)bricks/basic/src/image/ImageList.spec.tsx
(2 hunks)bricks/basic/src/image/Preview.spec.tsx
(1 hunks)bricks/basic/src/image/hooks/useTransform.spec.ts
(1 hunks)bricks/basic/src/image/index.spec.ts
(1 hunks)bricks/basic/src/link/index.spec.tsx
(1 hunks)bricks/basic/src/link/index.tsx
(1 hunks)bricks/basic/src/loading-container/index.spec.tsx
(1 hunks)bricks/basic/src/menu-group/index.spec.tsx
(1 hunks)bricks/basic/src/menu-item-sub-menu/index.spec.tsx
(1 hunks)bricks/basic/src/menu-item/index.spec.ts
(1 hunks)bricks/basic/src/menu/index.spec.ts
(1 hunks)bricks/basic/src/message-listener/index.spec.tsx
(1 hunks)bricks/basic/src/mini-actions/index.spec.tsx
(1 hunks)bricks/basic/src/page-title/index.spec.tsx
(1 hunks)bricks/basic/src/popover/index.spec.tsx
(1 hunks)bricks/basic/src/popover/index.tsx
(1 hunks)bricks/basic/src/sidebar-sub-menu/index.spec.tsx
(1 hunks)bricks/basic/src/sidebar/index.spec.tsx
(1 hunks)bricks/basic/src/sidebar/sidebar-menu-group/index.spec.tsx
(1 hunks)bricks/basic/src/sidebar/sidebar-menu-item/index.spec.tsx
(1 hunks)bricks/basic/src/sidebar/sidebar-menu-submenu/index.spec.tsx
(1 hunks)bricks/basic/src/sidebar/sidebar-menu/index.spec.tsx
(1 hunks)bricks/basic/src/tag-list/index.spec.ts
(1 hunks)bricks/basic/src/tag/index.spec.ts
(1 hunks)bricks/basic/src/text/index.spec.ts
(1 hunks)bricks/basic/src/text/index.tsx
(1 hunks)bricks/basic/src/tooltip/index.spec.tsx
(1 hunks)bricks/icons/package.json
(1 hunks)bricks/icons/src/easyops-icon/index.spec.ts
(1 hunks)bricks/icons/src/fa-icon/index.spec.ts
(1 hunks)bricks/icons/src/general-icon/index.spec.ts
(1 hunks)bricks/icons/src/general-icon/index.tsx
(1 hunks)bricks/icons/src/img-icon/index.spec.tsx
(1 hunks)bricks/illustrations/package.json
(1 hunks)bricks/illustrations/src/illustration-message/index.spec.tsx
(1 hunks)bricks/illustrations/src/loading-transition/index.spec.tsx
(1 hunks)package.json
(2 hunks)shared/general/package.json
(1 hunks)
✅ Files skipped from review due to trivial changes (3)
- bricks/icons/src/general-icon/index.tsx
- bricks/basic/src/editors/eo-next-table/index.tsx
- bricks/basic/src/broadcast-channel/index.tsx
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Size check (20.x)
- GitHub Check: Build docs (20.x)
🔇 Additional comments (64)
bricks/basic/src/menu/index.spec.ts (1)
2-2
: 从 react-dom/test-utils 迁移到 react 的更改符合预期这个更改符合 React 19 的最佳实践,因为测试工具已被整合到核心 react 包中。测试实现看起来是正确的,并且与新版本兼容。
建议运行以下命令验证其他测试文件是否也进行了类似的迁移:
✅ Verification successful
所有测试文件都已完成 act 导入源的迁移
代码库中的所有测试文件都已经从 react 包中导入 act,没有发现任何遗留的 react-dom/test-utils 导入。这个更改是完整且一致的。
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 检查是否还有其他文件从 react-dom/test-utils 导入 act rg "from ['\"]react-dom/test-utils['\"]" "bricks/"Length of output: 54
Script:
#!/bin/bash # 搜索所有 act 的导入语句 rg "import.*\{.*act.*\}.*from" "bricks/" # 专门在测试文件中搜索 act 的使用 fd "\.spec\.(ts|tsx)$" "bricks/" --exec rg "act" {}Length of output: 21962
bricks/basic/src/event-agent/index.spec.ts (1)
2-2
: 导入更改符合 React 19 规范此更改与 React 19 的架构变更保持一致。事件处理的测试实现仍然有效,不需要其他修改。
bricks/illustrations/src/loading-transition/index.spec.tsx (1)
2-2
: React 19 导入路径更新更新了 act 的导入路径以符合 React 19 的新规范。Shadow DOM 的测试方法保持不变且有效。
bricks/basic/src/sidebar/sidebar-menu-item/index.spec.tsx (1)
2-2
: 导入更改符合 React 19 的最佳实践!从
react
导入act
而不是react-dom/test-utils
是 React 19 中推荐的做法。这个改动符合新版本的标准。bricks/basic/src/image/index.spec.ts (2)
2-2
: 导入更改正确,但需要注意测试失败问题从
react
导入act
的更改是正确的,符合 React 19 的标准。
Line range hint
8-8
: 需要解决测试失败问题注意到代码中存在 TODO 注释提到测试失败问题。在升级到 React 19 的过程中,建议优先解决这个问题,以确保测试套件的可靠性。
需要我帮助调查和修复测试失败的问题吗?
bricks/basic/src/menu-item-sub-menu/index.spec.tsx (1)
2-2
: 导入更改正确,异步测试实现合理!从
react
导入act
的更改符合 React 19 标准。测试中的异步实现方式也符合最佳实践。bricks/basic/src/sidebar/sidebar-menu/index.spec.tsx (1)
2-2
: 导入更改正确,但建议验证 act 的使用模式从
react
导入act
的更改符合 React 19 标准。建议验证同步和异步
act
的混合使用模式在 React 19 中是否仍然是最佳实践。可以参考 React 19 的官方文档进行确认。✅ Verification successful
导入变更和 act 使用模式均符合规范
经过验证,当前代码库中:
- 从
react
导入act
的做法与其他测试文件保持一致- 同步和异步
act
的混合使用是标准测试模式,用于处理不同类型的状态更新和副作用- 这种实现方式符合 React 测试最佳实践
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 搜索其他测试文件中 act 的使用模式,以确保一致性 rg -B 2 -A 2 "await act|act\(\(\)" --type ts --type tsxLength of output: 85
Script:
#!/bin/bash # Search for act usage patterns in test files rg -t ts "await act|act\(\(\)" . # Search for React testing library imports rg -t ts "@testing-library/react" . # Search for direct React imports with act rg -t ts "import.*\{.*act.*\}.*from.*['\"]react['\"]" .Length of output: 28318
bricks/basic/src/breadcrumb-item/index.spec.tsx (1)
2-2
: 导入语句更新符合 React 19 规范!从
react-dom/test-utils
迁移到react
的更改是正确的,这符合 React 19 中act
的新位置。bricks/basic/src/avatar-group/index.spec.tsx (1)
2-2
: 导入更新正确实施!
act
的导入位置更改符合 React 19 的最佳实践。测试中的异步操作处理方式保持不变且有效。bricks/basic/src/easyops-avatar/index.spec.tsx (1)
2-2
: 导入更新正确,建议检查快照!
act
的导入更改符合 React 19 规范- 由于 React 19 的更新,建议验证测试快照是否需要更新
✅ Verification successful
导入更改已验证,快照测试无需更新!
- 已确认测试文件使用内联快照(inline snapshot)测试渲染结果
act
的导入更改不会影响组件渲染结果和快照内容- 现有快照测试结构符合 React 19 规范
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 检查是否有其他需要更新的快照测试 jest --listTests | grep -i snapshotLength of output: 132
Script:
#!/bin/bash # Find snapshot files echo "=== Searching for snapshot files ===" fd -e snap -e snapshot # Find snapshot test assertions echo -e "\n=== Searching for snapshot test patterns ===" rg -l "toMatchSnapshot|toMatchInlineSnapshot" --type ts --type tsxLength of output: 309
Script:
#!/bin/bash # Check the specific test file content echo "=== Checking easyops-avatar test file ===" cat bricks/basic/src/easyops-avatar/index.spec.tsx # Search for snapshot patterns without type restrictions echo -e "\n=== Searching for snapshot patterns ===" rg "toMatchSnapshot|toMatchInlineSnapshot"Length of output: 9062
bricks/basic/src/app-bar-wrapper/index.spec.tsx (1)
2-2
: 导入语句更新正确从 React 19 的新位置导入
act
是正确的,测试用例中的使用方式也符合要求。bricks/basic/src/sidebar/sidebar-menu-group/index.spec.tsx (1)
2-2
: 导入语句更新正确从 React 19 的新位置导入
act
是正确的。bricks/basic/src/page-title/index.spec.tsx (2)
2-2
: 导入语句更新正确从 React 19 的新位置导入
act
是正确的,测试用例中的使用方式(包括快照测试)也符合要求。
1-1
: 验证其他 React DOM 测试工具的使用情况由于 React 19 中将一些测试工具从 react-dom/test-utils 移动到了 react 包中,建议检查是否还有其他需要更新的测试工具导入。
✅ Verification successful
测试工具导入来源已符合 React 19 要求
代码库中的测试文件已经在使用 React Testing Library 和正确的测试工具导入来源,无需进行更改。
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 检查是否还有其他从 react-dom/test-utils 导入的测试工具 # 搜索所有测试文件中的 react-dom/test-utils 导入 rg "from ['\"]react-dom/test-utils['\"]" -g "*.spec.ts" -g "*.spec.tsx"Length of output: 77
Script:
#!/bin/bash # 扩大搜索范围以查找所有可能的测试工具使用情况 # 1. 搜索所有来自 react-dom 的导入 echo "=== Checking all react-dom imports in test files ===" rg "from ['\"]react-dom.*['\"]" -g "*.spec.ts" -g "*.spec.tsx" -g "*.test.ts" -g "*.test.tsx" # 2. 搜索常见测试工具的使用 echo -e "\n=== Checking common test utility usage ===" rg "(?:fireEvent|act|render)\(" -g "*.spec.ts" -g "*.spec.tsx" -g "*.test.ts" -g "*.test.tsx" # 3. 检查是否有其他测试相关的导入 echo -e "\n=== Checking other testing related imports ===" rg "import.*(?:fireEvent|act|render).*from" -g "*.spec.ts" -g "*.spec.tsx" -g "*.test.ts" -g "*.test.tsx"Length of output: 32745
bricks/basic/src/tag-list/index.spec.ts (1)
2-2
: 导入源更改符合 React 19 规范!将
act
从react-dom/test-utils
移动到react
包是 React 19 推荐的做法。这个更改不会影响测试行为,因为act
的功能保持不变。bricks/basic/src/dropdown-button/index.spec.ts (1)
2-2
: 导入更改与其他文件保持一致!此更改与项目中的其他测试文件保持一致,符合 React 19 的最佳实践。
bricks/basic/src/iframe/index.spec.tsx (1)
2-2
: 导入更改正确,异步测试处理得当!更改符合 React 19 规范。特别注意到该文件正确使用了异步的
act()
来处理异步更新,这是一个很好的实践。bricks/basic/src/menu-item/index.spec.ts (1)
2-2
: React 19 测试工具更新将
act
的导入源更改为react
符合 React 19 的架构变化。bricks/basic/src/sidebar/sidebar-menu-submenu/index.spec.tsx (1)
2-5
: 验证测试文件的 React 19 兼容性需要确保所有测试文件都已更新为从
react
导入act
。bricks/basic/src/message-listener/index.spec.tsx (2)
2-2
: 导入源更改正确从
react-dom/test-utils
更改为react
的导入源符合 React 19 的新规范。
Line range hint
1-93
: 验证 React 19 兼容性请确保所有测试用例在 React 19 环境下仍然按预期工作。特别是异步操作的处理,因为 React 19 对并发特性有所增强。
✅ Verification successful
测试代码已符合 React 19 兼容性要求
该测试文件已经采用了稳定的测试模式:
- 使用 React 核心包中的
act
- 正确处理了异步操作
- 没有使用已废弃的特性
- 测试对象是独立于 React 渲染生命周期的 Web Component
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 检查是否有其他依赖于 react-dom/test-utils 的导入 rg "from ['\"]react-dom/test-utils['\"]" -l # 检查是否有使用已弃用的 React 18 特性 ast-grep --pattern 'ReactDOM.render($$$)'Length of output: 93
Script:
#!/bin/bash # Check for other React testing utilities and patterns rg "from ['\"](react-test-renderer|@testing-library/react)" -l # Look for timing-sensitive patterns rg "(setTimeout|setInterval|requestAnimationFrame)" -A 2 "*.spec.ts" "*.spec.tsx" "*.test.ts" "*.test.tsx" # Check for concurrent mode features rg "createRoot|hydrateRoot|Suspense|useTransition|useDeferredValue" -lLength of output: 1309
bricks/basic/src/dropdown-actions/index.spec.tsx (1)
2-2
: 导入源更改正确从
react-dom/test-utils
更改为react
的导入源符合 React 19 的新规范。bricks/icons/src/img-icon/index.spec.tsx (2)
2-2
: 导入源更改正确从
react-dom/test-utils
更改为react
的导入源符合 React 19 的新规范。
Line range hint
1-102
: 验证图片加载行为由于 React 19 的并发渲染特性,建议验证图片加载和错误处理在并发模式下的行为是否符合预期。
bricks/basic/src/loading-container/index.spec.tsx (1)
2-2
: 导入源更改正确从
react-dom/test-utils
更改为react
的导入源符合 React 19 的新规范。bricks/basic/src/formatter-number/index.spec.tsx (1)
2-2
: 从 react-dom/test-utils 迁移到 react 的 act 函数此更改是 React 19 升级的一部分。React 19 中,
act
函数已被移至核心 React 包中,这是一个推荐的变更。运行以下命令以验证其他测试文件是否也进行了相同的更新:
✅ Verification successful
从 react-dom/test-utils 到 react 的 act 函数迁移已完成
代码库中所有测试文件都已经完成了迁移,现在统一使用
import { act } from "react"
的方式导入。🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 检查是否还有任何文件从 react-dom/test-utils 导入 act rg "import.*\{.*act.*\}.*from.*['\"]react-dom/test-utils['\"]"Length of output: 68
Script:
#!/bin/bash # 使用更宽松的模式搜索从 react-dom/test-utils 导入的 act echo "=== 检查 react-dom/test-utils 中的 act ===" rg -i "from.*react-dom.*test.*utils.*" -g "*.spec.*" -g "*.test.*" echo -e "\n=== 检查从 react 导入的 act ===" rg "import.*act.*from.*['\"]react['\"]" -g "*.spec.*" -g "*.test.*" echo -e "\n=== 检查是否还有使用 react-dom/test-utils 的文件 ===" rg "react-dom/test-utils" -g "*.spec.*" -g "*.test.*"Length of output: 4829
bricks/basic/src/counter-badge/index.spec.tsx (1)
2-2
: 确认 act 导入更改的一致性此更改与 React 19 的最佳实践保持一致。
bricks/basic/src/tag/index.spec.ts (1)
2-2
: 验证异步测试中的 act 使用此文件中的 act 使用正确。请注意确保所有异步操作都正确包装在 act 中。
运行以下命令以检查异步测试中的 act 使用:
✅ Verification successful
异步测试中的 act 使用验证完成
代码中所有的 DOM 操作、事件触发和清理工作都已正确地包装在
act
中,符合 React 测试最佳实践。🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 检查异步测试中是否正确使用了 act ast-grep --pattern 'test("$_", async $_)'Length of output: 43
Script:
#!/bin/bash # 显示测试文件内容以了解具体的测试框架语法 echo "=== 文件内容 ===" cat "bricks/basic/src/tag/index.spec.ts" echo -e "\n=== 查找异步测试 ===" # 使用更多模式来查找异步测试 ast-grep --pattern 'it("$_", async $_)' ast-grep --pattern "it('$_', async $_)" ast-grep --pattern 'describe("$_", async $_)' ast-grep --pattern "describe('$_', async $_)" echo -e "\n=== 查找 act 使用 ===" rg "act\(" "bricks/basic/src/tag/index.spec.ts" -A 2Length of output: 3851
bricks/basic/src/text/index.spec.ts (1)
2-2
: 确保与 @testing-library/dom 的兼容性此文件同时使用了 React 的 act 和 @testing-library/dom 的工具。这种组合在 React 19 中是有效的。
运行以下命令以检查测试库的版本兼容性:
✅ Verification successful
测试代码已符合 React 19 兼容性要求
代码中 React 的
act
和@testing-library/dom
的工具使用方式正确,且项目已明确使用 React 19。测试代码遵循了最佳实践,不需要额外修改。🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 检查 package.json 中的依赖版本 cat package.json | jq '.dependencies["@testing-library/dom"], .dependencies["react"]'Length of output: 97
Script:
#!/bin/bash # Check devDependencies versions echo "Checking devDependencies versions:" cat package.json | jq '.devDependencies["@testing-library/dom"], .devDependencies["react"]' echo -e "\nChecking file content for @testing-library/dom usage:" cat "bricks/basic/src/text/index.spec.ts" echo -e "\nSearching for other @testing-library imports in the file:" rg "@testing-library" "bricks/basic/src/text/index.spec.ts"Length of output: 3605
Script:
#!/bin/bash # Check for workspace package.json files echo "Checking workspace package.json files:" fd package.json --type f --exec cat {} \; | jq -c 'select(.dependencies["@testing-library/dom"] != null or .dependencies["react"] != null or .devDependencies["@testing-library/dom"] != null or .devDependencies["react"] != null) | {name: .name, dependencies: .dependencies, devDependencies: .devDependencies}'Length of output: 2150
bricks/basic/src/mini-actions/index.spec.tsx (1)
3-3
: 从 react-dom/test-utils 迁移到 react 的修改是正确的此更改符合 React 19 中将测试工具整合到核心包的变更。
bricks/basic/src/tooltip/index.spec.tsx (1)
2-2
: 从 react-dom/test-utils 迁移到 react 的修改是正确的此更改符合 React 19 的最新实践。
bricks/basic/src/broadcast-channel/index.spec.tsx (1)
2-2
: 从 react-dom/test-utils 迁移到 react 的修改是正确的此更改与其他测试文件保持一致,符合 React 19 的要求。
bricks/basic/src/image/Preview.spec.tsx (1)
6-6
: 从 react-dom/test-utils 迁移到 react 的修改是正确的此更改符合 React 19 的架构调整,建议验证异步测试行为是否与之前一致。
✅ Verification successful
从 react-dom/test-utils 迁移到 react 的修改已完全验证
经过完整的代码库扫描,确认:
- 所有测试文件都已经使用
import { act } from "react"
的新导入方式- 没有发现任何遗留的 react-dom/test-utils 导入
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 验证其他测试文件中是否还有使用旧的 react-dom/test-utils 导入 rg "from ['\"]react-dom/test-utils['\"]" -t tsx -t tsLength of output: 87
Script:
#!/bin/bash # Search for any imports from react-dom/test-utils rg "from ['\"]react-dom/test-utils['\"]" # Also search for specific act import from react-dom/test-utils rg "import \{ .*act.* \} from ['\"]react-dom/test-utils['\"]" # Check current act imports from react rg "import \{ .*act.* \} from ['\"]react['\"]"Length of output: 4144
bricks/basic/src/avatar/index.spec.tsx (1)
2-2
: 从 react-dom/test-utils 迁移到 react 的变更此更改符合 React 19 的最新实践,其中测试工具已被移至主包中。这是一个积极的改进,可以减少包的依赖性。
让我们验证此更改是否与其他测试文件保持一致:
✅ Verification successful
导入变更验证完成:符合最新实践且保持一致性
代码库中所有测试文件都已统一使用
import { act } from "react"
的新导入方式,没有发现任何遗留的react-dom/test-utils
导入。此更改完全符合 React 19 的最新实践标准。🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 检查所有测试文件中的 act 导入 rg "import.*\{.*act.*\}.*from.*[\"']react-dom/test-utils[\"']" -lLength of output: 71
Script:
#!/bin/bash # 搜索所有测试文件中的 react-dom/test-utils 导入 echo "=== 检查 react-dom/test-utils 的使用 ===" rg "from.*[\"']react-dom/test-utils[\"']" --type-add 'test:*{test,spec}.*' -t test echo -e "\n=== 检查 act 从 react 的导入 ===" rg "import.*\{.*act.*\}.*from.*[\"']react[\"']" --type-add 'test:*{test,spec}.*' -t testLength of output: 4310
bricks/basic/src/sidebar-sub-menu/index.spec.tsx (1)
2-2
: 导入声明更新符合预期此更改与其他测试文件保持一致,遵循了 React 19 的最新实践。
bricks/basic/src/button/index.spec.ts (1)
2-2
: 导入路径更新正确更改符合 React 19 的规范,保持了与其他测试文件的一致性。
bricks/illustrations/src/illustration-message/index.spec.tsx (1)
2-2
: act 导入路径已更新此更改与其他测试文件保持一致,符合 React 19 的最新实践。
让我们验证测试行为在新版本中是否保持不变:
✅ Verification successful
导入路径更改验证完成
代码库中绝大多数测试文件都直接从 "react" 导入
act
,此更改符合当前代码库的主流模式和 React 19 的最佳实践。测试行为保持一致且稳定。🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 检查所有使用 act 的异步测试场景 ast-grep --pattern 'await act(async () => { $$$ })'Length of output: 18421
Script:
#!/bin/bash # Search for all import statements of `act` rg "import.*\{.*act.*\}.*from.*['\"].*['\"]" -g "*.spec.ts*"Length of output: 4304
bricks/basic/src/actions/index.spec.tsx (1)
2-2
: 从 react-dom/test-utils 迁移到 react 的变更是正确的这个改动符合 React 19 中将测试工具整合到核心包的变化。
bricks/basic/src/dropdown-select/index.spec.tsx (1)
2-2
: 从 react-dom/test-utils 迁移到 react 的变更是正确的这个改动符合 React 19 中将测试工具整合到核心包的变化。
bricks/basic/src/easyops-avatar/useUserInfoByNameOrInstanceId.spec.tsx (1)
2-2
: 从 react-dom/test-utils 迁移到 react 的变更是正确的这个改动符合 React 19 中将测试工具整合到核心包的变化。
bricks/basic/src/link/index.spec.tsx (1)
2-2
: 从 react-dom/test-utils 迁移到 react 的变更是正确的这个改动符合 React 19 中将测试工具整合到核心包的变化。
建议运行以下脚本来验证所有测试文件是否都已更新了 act 的导入源:
✅ Verification successful
导入源迁移验证完成
经过验证,所有测试文件都已正确地从
react
包导入act
,没有发现任何遗留的react-dom/test-utils
导入。此次迁移符合预期且保持一致性。🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 描述:检查是否还有测试文件从 react-dom/test-utils 导入 act # 搜索仍然从 react-dom/test-utils 导入 act 的文件 rg "import.*\{.*act.*\}.*from.*['\"]react-dom/test-utils['\"]" -g "*.spec.ts*"Length of output: 84
Script:
#!/bin/bash # 检查所有从 react-dom/test-utils 的导入 echo "=== 检查 react-dom/test-utils 的导入 ===" rg "from.*['\"]react-dom/test-utils['\"]" -g "*.spec.ts*" # 检查所有 act 的导入来源 echo -e "\n=== 检查所有 act 的导入 ===" rg "import.*act.*from" -g "*.spec.ts*"Length of output: 4883
bricks/icons/src/general-icon/index.spec.ts (2)
2-2
: 导入语句更新符合 React 19 标准!从
react-dom/test-utils
迁移到react
的更改符合 React 19 的最佳实践。
Line range hint
1-180
: 建议验证测试用例在 React 19 环境下的完整性测试覆盖了以下关键场景:
- 基本图标渲染
- 图标库切换
- 回退机制
- 错误处理
建议执行完整的测试套件以确保与 React 19 的兼容性。
✅ Verification successful
测试用例已符合 React 19 最佳实践要求
测试套件已经采用了现代 React 测试模式:
- 正确使用
act()
包装所有状态更新和 DOM 操作- 适当处理异步操作和状态更新
- 完整的组件生命周期测试覆盖
- 没有使用已废弃的测试 API
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 验证测试覆盖率和潜在的兼容性问题 rg -l "act\(" | xargs rg "act\([^)]*\)" -A 2Length of output: 65583
bricks/icons/src/fa-icon/index.spec.ts (1)
1-1
: React 测试工具导入更新正确将
act
从 React DOM 测试工具迁移到核心 React 包符合最新实践。bricks/icons/src/easyops-icon/index.spec.ts (2)
2-2
: React 19 导入路径更新完成成功更新了
act
的导入路径,符合 React 19 的规范。
Line range hint
1-250
: 建议验证 SVG 操作在 React 19 中的兼容性SVG 操作和 DOM 操作在 React 19 中可能有细微变化,建议特别关注:
- SVG 属性处理
- DOM 操作时序
✅ Verification successful
SVG 和 DOM 操作与 React 19 兼容
经过验证,当前代码中的 SVG 和 DOM 操作使用的都是标准 Web API,不依赖于 React 的具体实现。React 19 没有引入任何会影响这些操作的破坏性变更。
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 检查 SVG 相关的测试用例 rg "svg" -A 3 -B 3Length of output: 84209
bricks/basic/src/context-menu/index.spec.tsx (2)
2-2
: React 19 测试工具导入路径规范化成功将
act
的导入从react-dom/test-utils
更新到react
。
Line range hint
1-300
: 建议验证事件处理在 React 19 中的行为由于 React 19 中的事件系统可能有变化,建议重点验证:
- 事件冒泡行为
- 事件处理时序
- 自定义事件的处理
bricks/basic/src/data-providers/show-notification/show-notification.spec.tsx (1)
3-3
: 导入语句更新符合 React 19 规范!将
act
从react-dom/test-utils
移动到react
是 React 19 中的推荐做法,这样可以确保测试工具的一致性。bricks/basic/src/link/index.tsx (1)
27-28
: 类型导出语法优化!使用
export type
替代export
来导出类型是一个很好的改进:
- 更明确地表示这些是类型导出
- 符合 TypeScript 的最佳实践
- 有助于构建工具进行更好的优化
bricks/basic/src/text/index.tsx (1)
1-1
: 类型导入优化提升了类型安全性!添加
type JSX
导入是一个很好的改进:
- 为
typeElementNameMap
提供了更准确的类型定义- 增强了 JSX 元素的类型安全性
- 符合 React 19 的类型系统最佳实践
bricks/basic/src/frame-breadcrumb/index.spec.tsx (1)
2-2
: 测试工具导入更新符合最新规范!将
act
的导入源从react-dom/test-utils
更改为react
是正确的:
- 符合 React 19 的最新实践
- 保持了测试工具使用的一致性
- 简化了测试相关的依赖管理
bricks/basic/src/popover/index.spec.tsx (1)
2-2
: 更新了 React 测试工具的导入源将
act
的导入源从react-dom/test-utils
更改为react
符合 React 19 的最新实践。bricks/basic/src/popover/index.tsx (1)
421-422
: 优化了导出语句的结构将类型导出(
Placement
)与值导出(Popover
)分开,这样可以:
- 提高代码的可维护性
- 支持更好的树摇(tree-shaking)
- 符合 TypeScript 的最佳实践
bricks/basic/src/sidebar/index.spec.tsx (1)
2-2
: 统一了测试工具的导入方式将
act
的导入源从react-dom/test-utils
更改为react
,保持与其他组件测试文件的一致性。bricks/basic/package.json (3)
47-48
: 谨慎使用 canary 版本的依赖
@next-core/react-element
和@next-core/react-runtime
使用了 canary 版本(^2.0.0-canary.0),建议:
- 在生产环境使用前进行充分测试
- 关注这些包的稳定版本发布时间
- 建立回滚策略
59-59
: 验证 React 19 升级的兼容性升级到 React 19 是一个重要的变更,需要:
- 全面测试所有组件的功能
- 确保与其他依赖包的兼容性
- 关注性能变化
✅ Verification successful
React 19 升级验证结果
代码库检查显示:
- 未发现使用已废弃的生命周期方法
- 广泛使用现代 React Hooks 和特性
- 代码模式符合 React 最佳实践
建议:
- 重点测试使用 Hooks(useEffect、useMemo 等)的组件
- 优先验证 Suspense 和 lazy loading 功能
- 关注
bricks/basic
目录下的核心组件🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 检查是否有使用已废弃的 React API rg -l "componentWillMount|componentWillReceiveProps|componentWillUpdate"Length of output: 74
Script:
#!/bin/bash # Check React related dependencies and their versions cat package.json | jq '.dependencies,.peerDependencies | with_entries(select(.key | contains("react")))' # Search for potential React 19 breaking changes patterns rg -l "useEffect|useMemo|useCallback|useState|useRef|createRef|forwardRef|memo|Suspense|lazy|Fragment"Length of output: 3138
46-46
: 新增依赖包的必要性验证新增了
@next-core/pipes
和@next-core/utils
依赖,建议:
- 确认这些依赖的具体用途
- 评估是否存在功能重叠
- 检查包大小的影响
Also applies to: 52-52
✅ Verification successful
依赖包使用情况确认完毕
@next-core/pipes
用于数字格式化组件中的单位转换功能,特别是处理字节单位(B、KB、MB等)的转换@next-core/utils
在多个包中广泛使用,支持核心功能如HTTP请求、通知、对话框等- 两个依赖包功能定位明确,无重叠,均有其必要性
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 检查新增依赖的使用情况 echo "Checking @next-core/pipes usage:" rg -l "@next-core/pipes" echo "Checking @next-core/utils usage:" rg -l "@next-core/utils"Length of output: 1646
Script:
#!/bin/bash # Check specific usage of pipes in formatter-number echo "Checking pipes usage in formatter-number:" rg "@next-core/pipes" bricks/basic/src/formatter-number/index.tsx -A 5 # Check the formatter-number implementation echo -e "\nChecking formatter-number implementation:" cat bricks/basic/src/formatter-number/index.tsxLength of output: 3523
bricks/illustrations/package.json (1)
62-63
: 需要验证 React 19 和相关依赖的兼容性请注意以下几点:
- 从实验版本升级到正式版本 React 19 可能会带来重大变化
- @next-core/react-element 和 @next-core/react-runtime 使用了 canary 预发布版本
Also applies to: 67-67
✅ Verification successful
React 19 和相关依赖的兼容性验证已完成
代码库已经为 React 19 做好了准备:
- 没有使用已废弃的 API
- 所有包都统一使用 React 19
- @next-core/react-element 和 @next-core/react-runtime 的 canary 版本专门为 React 19 适配
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 检查是否有使用已废弃的 React API rg -l "ReactDOM\.render|ReactDOM\.unmountComponentAtNode|React\.createClass|React\.PropTypes"Length of output: 95
Script:
#!/bin/bash # Check for potential React 19 compatibility issues echo "=== Checking React component definitions ===" ast-grep --pattern 'const $_ = React.FC<$_>' echo "=== Checking @next-core package usage ===" rg "@next-core/react-(element|runtime)" -A 2 -B 2 echo "=== Checking package.json for React version ===" fd package.json --exec cat {} | jq -c 'select(.dependencies.react != null) | {name: .name, react: .dependencies.react, "react-dom": .dependencies["react-dom"]}'Length of output: 29406
Script:
#!/bin/bash # Check for React 19 specific features and patterns echo "=== Checking for use client/server directives ===" rg "^['|\"]use (client|server)['|\"]" -l echo "=== Checking for new React 19 hooks ===" rg "use(FormState|FormStatus|Optimistic)" -l echo "=== Checking package dependencies for potential conflicts ===" fd package.json --exec cat {} | jq -c 'select(.dependencies != null) | {name: .name, dependencies: .dependencies | with_entries(select(.key | contains("react")))}'Length of output: 1278
shared/general/package.json (1)
65-65
: 建议验证 history 包的更新是否影响路由功能从 4.7.11 升级到 4.10.1 版本,虽然是小版本更新,但建议验证路由相关功能。
✅ Verification successful
history 包更新影响分析完成
经过验证,history 包从 4.7.11 升级到 4.10.1 是安全的:
- 代码仅使用稳定的类型定义(如
LocationDescriptor
、Location
)和核心工具函数- 4.x.x 版本更新遵循语义化版本规范,保证向后兼容性
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 检查代码中 history 包的使用情况 rg "from 'history'" -A 3Length of output: 32
Script:
#!/bin/bash # Search for various history package usage patterns echo "=== Searching for history imports ===" rg "(?:import|require).+['\"]history['\"]" -g "!package*.json" echo -e "\n=== Searching for createBrowserHistory usage ===" rg "createBrowserHistory|createHashHistory|createMemoryHistory" echo -e "\n=== Searching for history type definitions ===" rg "History<|history\:" -g "*.ts*"Length of output: 1282
bricks/icons/package.json (1)
79-79
: 确保所有包的 React 相关依赖版本一致React 和 @next-core/react-element 的版本更新需要与其他包保持一致,以避免潜在的版本冲突。
Also applies to: 83-83
✅ Verification successful
React 相关依赖版本已保持一致
经验证,所有包中的 React(^19.0.0)和 @next-core/react-element(^2.0.0-canary.0)版本均保持一致,不存在版本冲突问题。
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 检查所有 package.json 中 React 相关依赖的版本 fd package.json -x jq -r 'select(.dependencies.react != null) | "\(.name): React version: \(.dependencies.react)"'Length of output: 253
Script:
#!/bin/bash # 检查所有 package.json 中 @next-core/react-element 依赖的版本 fd package.json -x jq -r 'select(.dependencies["@next-core/react-element"] != null) | "\(.name): @next-core/react-element version: \(.dependencies["@next-core/react-element"])"'Length of output: 397
package.json (2)
86-88
: 确保 Babel 相关依赖版本兼容在 resolutions 中更新了 @babel/parser 和 @babel/runtime 的版本,需要确保与其他 Babel 相关依赖兼容。
✅ Verification successful
Babel 相关依赖版本兼容性验证完成
经检查,当前所有 Babel 相关依赖(@babel/parser ^7.26.5、@babel/runtime ^7.26.0、@babel/types ^7.22.5)都使用主版本 7,且采用 ^ 版本约束,保证了次要版本的向后兼容性。这些版本设置是相互兼容的,无需额外调整。
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 检查所有 Babel 相关依赖的版本 fd package.json -x jq -r 'select(.dependencies != null) | .dependencies | with_entries(select(.key | startswith("@babel"))) | to_entries[] | "\(.key): \(.value)"'Length of output: 186
56-56
: 开发工具链更新提醒
- TypeScript 升级到 5.7.3 可能需要更新类型定义
- React 类型定义升级到 19.x 版本
- yo 工具升级到 canary 版本可能影响脚手架功能
Also applies to: 64-65, 79-79
📐🤏 Size check result (3a2949e...bc61bfd): Load all bricks together
Critical changes:
See full changes
Load bricks by each packageCritical changes:
See full changes
Critical details for package basic
Critical details for package containers
Critical details for package form
Critical details for package icons
Critical details for package illustrations
Load by each brickCritical changes:
See full changes
Critical details for brick basic.dropdown-button
Critical details for brick basic.general-button
Critical details for brick basic.general-image
Critical details for brick basic.general-link
Critical details for brick basic.general-menu
Critical details for brick basic.general-menu-item
Critical details for brick basic.general-popover
Critical details for brick basic.general-tag
Critical details for brick basic.general-tag-list
Critical details for brick basic.general-text
Critical details for brick basic.show-dialog
Critical details for brick basic.show-notification
Critical details for brick containers.easy-view
Critical details for brick containers.flex-layout
Critical details for brick containers.general-card
Critical details for brick containers.general-category
Critical details for brick containers.general-drawer
Critical details for brick containers.general-modal
Critical details for brick containers.grid-layout
Critical details for brick containers.micro-view
Critical details for brick containers.search-bar
Critical details for brick containers.tab-group
Critical details for brick containers.tab-item
Critical details for brick containers.tab-list
Critical details for brick eo-actions
Critical details for brick eo-antd-icon
Critical details for brick eo-auto-complete
|
7386706
to
e29474b
Compare
There was a problem hiding this 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
🔭 Outside diff range comments (1)
bricks/basic/src/sidebar/index.tsx (1)
Line range hint
1-39
: 建议添加 'use client' 指令由于该组件使用了浏览器特定的 API(如 IntersectionObserver),建议将其标记为客户端组件。
+// 在文件顶部添加 +'use client'; + import React, { MouseEventHandler, useEffect, // ...
🧹 Nitpick comments (1)
bricks/basic/src/dropdown-select/i18n.ts (1)
1-1
: i18n 实现迁移建议从 React 特定的 i18n 实现迁移到核心 i18n 实现是一个好的改进。这种改变:
- 支持 React 19 的服务器组件架构
- 提供了更好的性能优化空间
Also applies to: 19-19
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
yarn.lock
is excluded by!**/yarn.lock
,!**/*.lock
📒 Files selected for processing (68)
bricks/basic/package.json
(1 hunks)bricks/basic/src/actions/index.spec.tsx
(1 hunks)bricks/basic/src/app-bar-wrapper/index.spec.tsx
(1 hunks)bricks/basic/src/avatar-group/index.spec.tsx
(1 hunks)bricks/basic/src/avatar/index.spec.tsx
(1 hunks)bricks/basic/src/breadcrumb-item/index.spec.tsx
(1 hunks)bricks/basic/src/breadcrumb/index.spec.tsx
(1 hunks)bricks/basic/src/broadcast-channel/index.spec.tsx
(1 hunks)bricks/basic/src/broadcast-channel/index.tsx
(1 hunks)bricks/basic/src/button/index.spec.ts
(1 hunks)bricks/basic/src/context-menu/index.spec.tsx
(1 hunks)bricks/basic/src/counter-badge/index.spec.tsx
(1 hunks)bricks/basic/src/data-providers/show-notification/show-notification.spec.tsx
(1 hunks)bricks/basic/src/data-providers/show-watermark/show-watermark.spec.tsx
(1 hunks)bricks/basic/src/dropdown-actions/index.spec.tsx
(1 hunks)bricks/basic/src/dropdown-button/index.spec.ts
(1 hunks)bricks/basic/src/dropdown-select/i18n.ts
(2 hunks)bricks/basic/src/dropdown-select/index.spec.tsx
(1 hunks)bricks/basic/src/dropdown-select/index.tsx
(2 hunks)bricks/basic/src/easyops-avatar/index.spec.tsx
(1 hunks)bricks/basic/src/easyops-avatar/useUserInfoByNameOrInstanceId.spec.tsx
(1 hunks)bricks/basic/src/editors/eo-descriptions/index.tsx
(1 hunks)bricks/basic/src/editors/eo-next-table/index.tsx
(1 hunks)bricks/basic/src/event-agent/index.spec.ts
(1 hunks)bricks/basic/src/formatter-number/index.spec.tsx
(1 hunks)bricks/basic/src/frame-breadcrumb/index.spec.tsx
(1 hunks)bricks/basic/src/iframe/index.spec.tsx
(1 hunks)bricks/basic/src/image/ImageList.spec.tsx
(2 hunks)bricks/basic/src/image/Preview.spec.tsx
(1 hunks)bricks/basic/src/image/hooks/useTransform.spec.ts
(1 hunks)bricks/basic/src/image/index.spec.ts
(1 hunks)bricks/basic/src/link/index.spec.tsx
(1 hunks)bricks/basic/src/link/index.tsx
(1 hunks)bricks/basic/src/loading-container/index.spec.tsx
(1 hunks)bricks/basic/src/menu-group/index.spec.tsx
(1 hunks)bricks/basic/src/menu-item-sub-menu/index.spec.tsx
(1 hunks)bricks/basic/src/menu-item/index.spec.ts
(1 hunks)bricks/basic/src/menu/index.spec.ts
(1 hunks)bricks/basic/src/message-listener/index.spec.tsx
(1 hunks)bricks/basic/src/mini-actions/index.spec.tsx
(1 hunks)bricks/basic/src/page-title/index.spec.tsx
(1 hunks)bricks/basic/src/popover/index.spec.tsx
(1 hunks)bricks/basic/src/popover/index.tsx
(1 hunks)bricks/basic/src/sidebar-sub-menu/index.spec.tsx
(1 hunks)bricks/basic/src/sidebar-sub-menu/index.tsx
(0 hunks)bricks/basic/src/sidebar/i18n.ts
(2 hunks)bricks/basic/src/sidebar/index.spec.tsx
(1 hunks)bricks/basic/src/sidebar/index.tsx
(1 hunks)bricks/basic/src/sidebar/sidebar-menu-group/index.spec.tsx
(1 hunks)bricks/basic/src/sidebar/sidebar-menu-item/index.spec.tsx
(1 hunks)bricks/basic/src/sidebar/sidebar-menu-submenu/index.spec.tsx
(1 hunks)bricks/basic/src/sidebar/sidebar-menu/index.spec.tsx
(1 hunks)bricks/basic/src/tag-list/index.spec.ts
(1 hunks)bricks/basic/src/tag/index.spec.ts
(1 hunks)bricks/basic/src/text/index.spec.ts
(1 hunks)bricks/basic/src/text/index.tsx
(1 hunks)bricks/basic/src/tooltip/index.spec.tsx
(1 hunks)bricks/icons/package.json
(1 hunks)bricks/icons/src/easyops-icon/index.spec.ts
(1 hunks)bricks/icons/src/fa-icon/index.spec.ts
(1 hunks)bricks/icons/src/general-icon/index.spec.ts
(1 hunks)bricks/icons/src/general-icon/index.tsx
(1 hunks)bricks/icons/src/img-icon/index.spec.tsx
(1 hunks)bricks/illustrations/package.json
(1 hunks)bricks/illustrations/src/illustration-message/index.spec.tsx
(1 hunks)bricks/illustrations/src/loading-transition/index.spec.tsx
(1 hunks)package.json
(2 hunks)shared/general/package.json
(1 hunks)
💤 Files with no reviewable changes (1)
- bricks/basic/src/sidebar-sub-menu/index.tsx
🚧 Files skipped from review as they are similar to previous changes (63)
- bricks/basic/src/context-menu/index.spec.tsx
- bricks/basic/src/broadcast-channel/index.spec.tsx
- bricks/basic/src/counter-badge/index.spec.tsx
- bricks/basic/src/app-bar-wrapper/index.spec.tsx
- bricks/basic/src/mini-actions/index.spec.tsx
- bricks/basic/src/editors/eo-descriptions/index.tsx
- bricks/basic/src/text/index.spec.ts
- bricks/illustrations/src/illustration-message/index.spec.tsx
- bricks/basic/src/sidebar/sidebar-menu-item/index.spec.tsx
- bricks/icons/src/easyops-icon/index.spec.ts
- bricks/basic/src/sidebar/sidebar-menu-submenu/index.spec.tsx
- bricks/basic/src/actions/index.spec.tsx
- bricks/basic/src/link/index.spec.tsx
- bricks/basic/src/breadcrumb-item/index.spec.tsx
- bricks/basic/src/dropdown-select/index.spec.tsx
- bricks/basic/src/avatar/index.spec.tsx
- bricks/basic/src/breadcrumb/index.spec.tsx
- bricks/basic/src/button/index.spec.ts
- bricks/basic/src/editors/eo-next-table/index.tsx
- bricks/basic/src/data-providers/show-notification/show-notification.spec.tsx
- bricks/basic/src/loading-container/index.spec.tsx
- bricks/basic/src/dropdown-button/index.spec.ts
- bricks/basic/src/easyops-avatar/useUserInfoByNameOrInstanceId.spec.tsx
- bricks/basic/src/tooltip/index.spec.tsx
- bricks/illustrations/src/loading-transition/index.spec.tsx
- bricks/basic/src/image/Preview.spec.tsx
- bricks/basic/src/image/index.spec.ts
- bricks/basic/src/iframe/index.spec.tsx
- bricks/basic/src/dropdown-actions/index.spec.tsx
- bricks/basic/src/formatter-number/index.spec.tsx
- bricks/basic/src/menu-group/index.spec.tsx
- bricks/basic/src/data-providers/show-watermark/show-watermark.spec.tsx
- bricks/basic/src/tag-list/index.spec.ts
- bricks/basic/src/sidebar/sidebar-menu-group/index.spec.tsx
- bricks/basic/src/menu-item-sub-menu/index.spec.tsx
- bricks/basic/src/popover/index.tsx
- bricks/icons/src/general-icon/index.spec.ts
- bricks/basic/src/sidebar/sidebar-menu/index.spec.tsx
- bricks/basic/src/message-listener/index.spec.tsx
- bricks/basic/src/tag/index.spec.ts
- bricks/basic/src/event-agent/index.spec.ts
- bricks/basic/src/easyops-avatar/index.spec.tsx
- bricks/basic/src/image/ImageList.spec.tsx
- bricks/basic/src/sidebar-sub-menu/index.spec.tsx
- bricks/basic/src/text/index.tsx
- bricks/basic/src/broadcast-channel/index.tsx
- bricks/icons/src/fa-icon/index.spec.ts
- bricks/basic/src/frame-breadcrumb/index.spec.tsx
- bricks/basic/src/page-title/index.spec.tsx
- bricks/basic/src/menu/index.spec.ts
- bricks/illustrations/package.json
- bricks/icons/package.json
- shared/general/package.json
- bricks/basic/src/image/hooks/useTransform.spec.ts
- bricks/icons/src/general-icon/index.tsx
- bricks/basic/src/popover/index.spec.tsx
- bricks/basic/src/sidebar/index.spec.tsx
- bricks/icons/src/img-icon/index.spec.tsx
- bricks/basic/src/avatar-group/index.spec.tsx
- bricks/basic/src/menu-item/index.spec.ts
- bricks/basic/src/link/index.tsx
- bricks/basic/package.json
- package.json
🔇 Additional comments (3)
bricks/basic/src/sidebar/i18n.ts (1)
1-1
: 保持了良好的实现一致性与 dropdown-select 组件采用了相同的 i18n 迁移模式,这种一致性有助于:
- 代码维护
- 开发者理解
- 未来升级
Also applies to: 25-25
bricks/basic/src/dropdown-select/index.tsx (1)
12-12
: 验证 React 19 兼容性建议验证以下几点:
- React.forwardRef 在 React 19 中的行为是否有变化
- 组件是否需要标记为客户端组件(使用 'use client' 指令)
- 确认新的 i18n 初始化方式在服务器组件中的行为
Also applies to: 30-30, 33-33
✅ Verification successful
无需额外的 React 19 兼容性更改
该组件已经采用了兼容的实现方式:
- 作为 Web Component,无需添加 'use client' 指令
- 已使用标准的
forwardRef
导入方式- i18n 初始化已正确迁移到新系统
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 检查是否有其他组件使用了旧的 i18n 初始化方式 rg "initializeReactI18n" --type tsLength of output: 34
Script:
#!/bin/bash # Check for 'use client' directives rg "'use client'" --type ts # Check React.forwardRef usage ast-grep --pattern 'React.forwardRef' # Check current file content cat bricks/basic/src/dropdown-select/index.tsxLength of output: 6568
bricks/basic/src/sidebar/index.tsx (1)
31-32
: React 19 升级检查清单为确保顺利升级到 React 19,建议检查:
- useEffect 的依赖项是否符合新的规范
- 确认所有使用的 hooks 在 React 19 中是否有变化
- 验证事件处理和 DOM 操作在新版本中的兼容性
Also applies to: 39-39
✅ Verification successful
React Hooks 实现符合最新规范
经过详细检查,sidebar 组件中的 useEffect hooks 实现完全符合 React 最佳实践:
- 所有副作用都有适当的清理函数
- 依赖数组定义正确
- 事件监听器和观察者都得到妥善处理
- 没有使用任何已废弃的模式
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # 检查可能受影响的 React hooks 使用 ast-grep --pattern 'useEffect($$$)'Length of output: 34724
e29474b
to
d9e7fde
Compare
d9e7fde
to
9c73262
Compare
13989ba
to
4360b0e
Compare
07a0322
to
05b32e0
Compare
05b32e0
to
fd7a920
Compare
371fd6e
to
415309c
Compare
415309c
to
a055f7c
Compare
a055f7c
to
48988f3
Compare
48988f3
to
4919021
Compare
4919021
to
fe12703
Compare
fe12703
to
1a7e238
Compare
依赖检查
组件之间的依赖声明,是微服务组件架构下的重要信息,请确保其正确性。
请勾选以下两组选项其中之一:
或者:
提交信息检查
Git 提交信息将决定包的版本发布及自动生成的 CHANGELOG,请检查工作内容与提交信息是否相符,并在以下每组选项中都依次确认。
破坏性变更:
feat
作为提交类型。BREAKING CHANGE: 你的变更说明
。新特性:
feat
作为提交类型。问题修复:
fix
作为提交类型。杂项工作:
即所有对下游使用者无任何影响、且没有必要显示在 CHANGELOG 中的改动,例如修改注释、测试用例、开发文档等:
chore
,docs
,test
等作为提交类型。Summary by CodeRabbit
以下是针对这些变更的发布说明:
依赖更新
@next-core/react-element
到 2.0.0-canary.0 版本@next-core/react-runtime
到 2.0.0-canary.0 版本@next-core/yo
到 2.0.0-canary.0 版本history
依赖到 4.10.1 版本测试相关
act
函数的导入源从react-dom/test-utils
更改为react
类型定义
type JSX
导入export type
国际化
t
常量以支持翻译其他
这些变更主要集中在依赖管理、测试工具、类型系统和国际化支持的改进上。