From 9be1f7ac61467737387cdd74e244f9855c2d5d12 Mon Sep 17 00:00:00 2001 From: Rairn <958414905@qq.com> Date: Thu, 4 May 2023 18:14:34 +0800 Subject: [PATCH] fix(RecordPicker): avoid error --- .../schema-component/antd/record-picker/InputRecordPicker.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/core/client/src/schema-component/antd/record-picker/InputRecordPicker.tsx b/packages/core/client/src/schema-component/antd/record-picker/InputRecordPicker.tsx index f6383b686..e92461495 100644 --- a/packages/core/client/src/schema-component/antd/record-picker/InputRecordPicker.tsx +++ b/packages/core/client/src/schema-component/antd/record-picker/InputRecordPicker.tsx @@ -47,7 +47,7 @@ const useTableSelectorProps = () => { rowSelection: { type: multiple ? 'checkbox' : 'radio', selectedRowKeys: rcSelectRows - .filter((item) => options.every((row) => row[rowKey] !== item[rowKey])) + ?.filter((item) => options.every((row) => row[rowKey] !== item[rowKey])) .map((item) => item[rowKey]), }, onRowSelectionChange(selectedRowKeys, selectedRows) { @@ -187,6 +187,7 @@ export const InputRecordPicker: React.FC = (props: IRecordPickerProps) => { const value = multiple ? [] : null; onChange(value); setSelectedRows(value); + setOptions([]); } else if (Array.isArray(changed)) { if (!changed.length) { onChange([]);