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: { rowSelection: {
type: multiple ? 'checkbox' : 'radio', type: multiple ? 'checkbox' : 'radio',
selectedRowKeys: rcSelectRows selectedRowKeys: rcSelectRows
.filter((item) => options.every((row) => row[rowKey] !== item[rowKey])) ?.filter((item) => options.every((row) => row[rowKey] !== item[rowKey]))
.map((item) => item[rowKey]), .map((item) => item[rowKey]),
}, },
onRowSelectionChange(selectedRowKeys, selectedRows) { onRowSelectionChange(selectedRowKeys, selectedRows) {
@ -187,6 +187,7 @@ export const InputRecordPicker: React.FC<any> = (props: IRecordPickerProps) => {
const value = multiple ? [] : null; const value = multiple ? [] : null;
onChange(value); onChange(value);
setSelectedRows(value); setSelectedRows(value);
setOptions([]);
} else if (Array.isArray(changed)) { } else if (Array.isArray(changed)) {
if (!changed.length) { if (!changed.length) {
onChange([]); onChange([]);