fix: 그룹 사용자 key 중복 이슈 해결

This commit is contained in:
2025-06-24 16:41:56 +09:00
parent d22034a237
commit 4696e2b710
@@ -57,7 +57,6 @@ function GroupUsersSection({ groupId }: GroupUsersSectionProps) {
getCoreRowModel: getCoreRowModel(),
onPaginationChange: setPagination,
onRowSelectionChange: setRowSelection,
getRowId: (row) => row.userUnqId,
},
dataTableOptions: {
viewPagination: true,
@@ -65,15 +64,18 @@ function GroupUsersSection({ groupId }: GroupUsersSectionProps) {
});
const handleDeleteSelected = async () => {
const selectedRows = Object.keys(rowSelection);
const selectedRows = table.getSelectedRowModel().rows.map((row) => ({
groupId: row.original.groupId,
userUnqId: row.original.userUnqId,
}));
if (selectedRows.length === 0 || !groupId) return;
if (!(await confirm("사용자를 삭제하시겠습니까?"))) return;
try {
const usersToDelete = selectedRows.map((userUnqId) => ({
const usersToDelete = selectedRows.map((row) => ({
mode: "D",
groupId,
userUnqId,
groupId: row.groupId,
userUnqId: row.userUnqId,
}));
await GroupUsersApi.saveGroupUser(usersToDelete);
@@ -90,6 +92,7 @@ function GroupUsersSection({ groupId }: GroupUsersSectionProps) {
useEffect(() => {
setPagination({ ...pagination, pageIndex: 0 });
setRowSelection({});
}, [groupId]);
return (