Conversation
演练BrickTree 组件内部逻辑改动,将树形数据检查、选择和状态派生的数据源从 defaultData 转换为 treeData,包括调整相关依赖数组和条件分支逻辑。 改动
预计代码审查工作量🎯 2 (简单) | ⏱️ ~10 分钟 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #533 +/- ##
=======================================
Coverage 85.82% 85.82%
=======================================
Files 1113 1113
Lines 25759 25766 +7
Branches 4238 4238
=======================================
+ Hits 22107 22114 +7
Misses 2778 2778
Partials 874 874
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
bricks/presentational-bricks/src/brick-tree/BrickTree.tsx (1)
488-495:⚠️ Potential issue | 🟠 Major
onCheck仍使用defaultData,过滤场景下会把全选状态算错。Line 491 和 Line 493 还在用
defaultData,会导致手动勾选后allChecked/indeterminate与当前过滤视图不一致,修复路径不完整。建议与上面useEffect的逻辑保持一致,统一使用treeData。建议修改
- if (!checkedNotRelevant) { - allChecked = defaultData.every((node) => checkedKeySet.has(node.key)); - } else { - const allKeys = getAllKeys(defaultData); - allChecked = allKeys.every((key) => checkedKeySet.has(key)); - } + if (!checkedNotRelevant) { + allChecked = getAllCheckedState(treeData, checkedKeySet); + } else { + const allKeys = getAllKeys(treeData); + allChecked = allKeys.every((key) => checkedKeySet.has(key)); + }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@bricks/presentational-bricks/src/brick-tree/BrickTree.tsx` around lines 488 - 495, The onCheck handler computes allChecked using defaultData which causes incorrect allChecked/indeterminate when a filter is active; change the logic in the onCheck block (where checkedKeySet, checkedNotRelevant, getAllKeys and allChecked are used) to mirror the useEffect logic and use treeData instead of defaultData when determining which nodes to consider (i.e., if checkedNotRelevant is false use treeData.every(...), otherwise use getAllKeys(treeData) to compute allKeys) so the computed allChecked/indeterminate aligns with the current filtered view.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@bricks/presentational-bricks/src/brick-tree/BrickTree.tsx`:
- Around line 488-495: The onCheck handler computes allChecked using defaultData
which causes incorrect allChecked/indeterminate when a filter is active; change
the logic in the onCheck block (where checkedKeySet, checkedNotRelevant,
getAllKeys and allChecked are used) to mirror the useEffect logic and use
treeData instead of defaultData when determining which nodes to consider (i.e.,
if checkedNotRelevant is false use treeData.every(...), otherwise use
getAllKeys(treeData) to compute allKeys) so the computed
allChecked/indeterminate aligns with the current filtered view.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to data retention organization setting
Run ID: b67bb97d-ad54-401d-936f-4c377595cb43
📒 Files selected for processing (1)
bricks/presentational-bricks/src/brick-tree/BrickTree.tsx
依赖检查
组件之间的依赖声明,是微服务组件架构下的重要信息,请确保其正确性。
请勾选以下两组选项其中之一:
或者:
提交信息检查
Git 提交信息将决定包的版本发布及自动生成的 CHANGELOG,请检查工作内容与提交信息是否相符,并在以下每组选项中都依次确认。
破坏性变更:
feat作为提交类型。BREAKING CHANGE: 你的变更说明。新特性:
feat作为提交类型。问题修复:
fix作为提交类型。杂项工作:
即所有对下游使用者无任何影响、且没有必要显示在 CHANGELOG 中的改动,例如修改注释、测试用例、开发文档等:
chore,docs,test等作为提交类型。Summary by CodeRabbit
发布说明