Repository navigation
Conversation
lnuxe
requested review from
HaixingOoO,
NWYLZW,
RylanBot,
ZWkang,
carolin913,
honkinglin and
uyarn
as code owners
November 12, 2026 09:59
EnhancedTable always passed a selectedRowKeys prop to the inner Table:
selectedRowKeys: isTreeData ? innerSelectedRowKeys : props.selectedRowKeys || [],
The key is present on every render, so useControlled treats the table as
controlled even when the caller never passed selectedRowKeys. Row selection
then never updates internally and clicking a checkbox does nothing.
Only pass the prop in the tree case, where the value is genuinely owned by
EnhancedTable.
Verified:
- new test fails on the previous implementation
(expected 't-checkbox' to contain 't-is-checked')
- new test passes with the fix
- table: 53 tests pass
lnuxe
force-pushed
the
fix/enhanced-table-non-tree-select
branch
from
November 13, 2026 03:04
8bca04a to
c4ec3d2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤔 这个 PR 的性质是?
🔗 相关 Issue
无(本 PR 直接修复非树形 EnhancedTable 的行选中失效)
📝 描述
EnhancedTable 无条件把
selectedRowKeys传给 PrimaryTable:useControlled用Reflect.has(props, 'selectedRowKeys')判断是否受控。因为 key 恒存在,表格永远被当成受控——而非树形数据时这个值恒为[]。点击行复选框会触发onSelectChange,但勾选状态永远回不来,复选框永远不勾上。文档明确 EnhancedTable 包含 PrimaryTable 的全部功能,非树形用法是合法的。
改动
只在树形数据时传这个 key,非树形时让 PrimaryTable 走自己的非受控逻辑:
🔍 自测
修复前(还原
EnhancedTable.tsx后跑新测试):修复后:
第二个用例确认
onSelectChange仍然正常回传选中行,修复没有把事件一起关掉。回归:
✅ 贡献者检查