fix(TreeSelect): preserve disabled child selection - #681
Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Walkthrough本次变更调整 ChangesSHOW_PARENT 保留逻辑
Estimated code review effort: 2 (简单) | ~10 分钟 Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #681 +/- ##
=======================================
Coverage 99.84% 99.84%
=======================================
Files 17 17
Lines 629 633 +4
Branches 178 181 +3
=======================================
+ Hits 628 632 +4
Misses 1 1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
❌ Deploy failed
📋 Build log (last lines)🤖 Powered by surge-preview |
|||||||||
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Scanned all 43 configured upstreams. The other 38 carried only `ci: fix React Doctor workflow` commits (verified to touch `.github/` only) and version bumps, so nothing to port there. select: - allow clearing the value via keyboard (react-component/select#1247). The clear button was already ported as an accessible <button>, but BaseSelect's Enter/Space handler preventDefault()-ed the native activation, so the click never fired. table: - support `forceRender` on expandable rows (rc-table 1.11.0), for both the plain and virtual body. - stop mutating the object returned by `column.onCell()`, the remaining gap from react-component/table#1488. The hover rowSpan part of that PR was already covered locally by 0365d60. - fix `Table.EXPAND_COLUMN` identity checks against Vue reactive proxies. `toRaw()` is now used before comparison: previously a `ref()`/`reactive()` column list made every `=== EXPAND_COLUMN` check fail, which both auto-inserted a second expand column at index 0 and rendered the user's sentinel as a phantom empty column. tree: - support `autoExpand` in `scrollTo`, plus the new `useTree` hook exposing `getPath` (react-component/tree#1061). `autoExpand` is guarded at the call site rather than inside `setExpandedKeys`, so the guard reverted in 5fe098f is not reintroduced. - add `-treenode-unselectable` class for non-checkable, non-selectable nodes (react-component/tree#1066). - add characterization tests pinning controlled `expandedKeys` behaviour, which deviates from upstream at three call sites as a consequence of 5fe098f. tree-select: - preserve disabled child selection under SHOW_PARENT (react-component/tree-select#681). virtual-list: - resolve `scrollTo({ key })` against the latest data and retry after a data update (react-component/virtual-list#376, #377). An unresolved key no longer scrolls the list to the top. Also adds the missing `@v-c/select` path alias, which unblocks `tree-select/tests/OptionList.test.tsx` (previously failing to collect), and registers @rc-component/listy as an upstream — it is already in sync at 1.2.3. Test suite: 785 passing (was 750), 26 pre-existing failures unchanged (steps, collapse, mutate-observer, cascader). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

Summary
SHOW_PARENTRoot cause
SHOW_PARENTfiltered every child whose parent was selected without considering whether the child itself was disabled. In a controlled TreeSelect, the emitted value therefore dropped the disabled child and cleared its selection on the next render.Validation
ut test --runInBand(184 tests passed)ut tscut lint(0 errors; 6 existing warnings)Related to ant-design/ant-design#16096
Summary by CodeRabbit
Bug 修复
SHOW_PARENT选择策略:勾选父节点时,已选中的禁用子节点会继续保留。TreeSelect中将同时正确显示父节点及其禁用子节点,避免已选内容意外丢失。测试