fix(RecordPicker): avoid error

This commit is contained in:
Rairn 2023-05-04 18:14:34 +08:00
parent 5c29262c95
commit 9be1f7ac61

View File

@ -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<any> = (props: IRecordPickerProps) => {
const value = multiple ? [] : null;
onChange(value);
setSelectedRows(value);
setOptions([]);
} else if (Array.isArray(changed)) {
if (!changed.length) {
onChange([]);