Skip to content

Commit 66fe197

Browse files
committed
fix: TreeSelect throw error when press enter in search
close ant-design/ant-design#30820
1 parent 9e237bd commit 66fe197

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/OptionList.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,11 @@ const OptionList: React.RefForwardingComponent<
205205

206206
// >>> Select item
207207
case KeyCode.ENTER: {
208-
if (activeEntity?.data?.selectable !== false) {
208+
const { selectable, value } = activeEntity?.data || {};
209+
if (selectable !== false) {
209210
onInternalSelect(null, {
210211
node: { key: activeKey },
211-
selected: !checkedKeys.includes(activeEntity.data.value),
212+
selected: !checkedKeys.includes(value),
212213
});
213214
}
214215
break;

0 commit comments

Comments
 (0)