mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 17:43:47 +00:00
fix: bulk actions frontend — selectedUserIds mapping, debounce cleanup
- Fix selectedUserIds: was mapping row keys as array indices instead of using them directly as user IDs (getRowId returns String(user.id)) - Add useEffect cleanup for search debounce timer on unmount
This commit is contained in:
@@ -719,6 +719,11 @@ export default function AdminBulkActions() {
|
||||
}, 400);
|
||||
};
|
||||
|
||||
// Cleanup debounce on unmount
|
||||
useEffect(() => {
|
||||
return () => clearTimeout(searchTimerRef.current);
|
||||
}, []);
|
||||
|
||||
const handleSearchSubmit = (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
clearTimeout(searchTimerRef.current);
|
||||
@@ -753,9 +758,9 @@ export default function AdminBulkActions() {
|
||||
const selectedUserIds = useMemo(() => {
|
||||
return Object.keys(rowSelection)
|
||||
.filter((k) => rowSelection[k])
|
||||
.map((idx) => users[Number(idx)]?.id)
|
||||
.filter(Boolean);
|
||||
}, [rowSelection, users]);
|
||||
.map(Number)
|
||||
.filter((id) => id > 0);
|
||||
}, [rowSelection]);
|
||||
|
||||
const handleOpenAction = (type: BulkActionType) => {
|
||||
setModal({ open: true, action: type, loading: false, result: null });
|
||||
|
||||
Reference in New Issue
Block a user