fix: refresh selection after deleting by batch

This commit is contained in:
jialin
2025-05-16 16:07:55 +08:00
parent febdc5b8e2
commit 6340f1fb54
4 changed files with 41 additions and 13 deletions
+11 -5
View File
@@ -199,13 +199,19 @@ export default function useTableFetch<ListItem>(options: {
...options,
async onOk() {
if (!deleteAPI) return;
await handleBatchRequest(rowSelection.selectedRowKeys, (id) =>
deleteAPI(id, {
...modalRef.current?.configuration
})
const successIds: any[] = [];
const res = await handleBatchRequest(
rowSelection.selectedRowKeys,
async (id: any) => {
await deleteAPI(id, {
...modalRef.current?.configuration
});
successIds.push(id);
}
);
rowSelection.clearSelections();
rowSelection.removeSelectedKeys(successIds);
fetchData();
return res;
}
});
};