diff --git a/compass/components/Table/Index.tsx b/compass/components/Table/Index.tsx index c245143..2b02c16 100644 --- a/compass/components/Table/Index.tsx +++ b/compass/components/Table/Index.tsx @@ -43,17 +43,20 @@ export const Table = () => { }; const hideUser = (userId: number) => { - console.log(`Hiding user with ID: ${userId}`); // Confirm the ID being processed + console.log(`Toggling visibility for user with ID: ${userId}`); setData(currentData => { const newData = currentData.map(user => { - console.log(`Checking user with ID: ${user.id}`); // Confirm each user's ID being checked - return user.id === userId ? { ...user, visible: false } : user; + if (user.id === userId) { + return { ...user, visible: !user.visible }; + } + return user; }).sort((a, b) => a.visible === b.visible ? 0 : a.visible ? -1 : 1); - console.log(newData); // Check the sorted data + console.log(newData); return newData; }); }; + const columns = [ columnHelper.display({ id: "options", @@ -114,22 +117,30 @@ export const Table = () => { ))} -
- {table.getRowModel().rows.map((row) => ( -