From 23688f83a6dd179ea7c593bc0f0ce506372f7a04 Mon Sep 17 00:00:00 2001 From: chimpdev Date: Sun, 15 Sep 2024 00:30:42 +0300 Subject: [PATCH] Refactor handleSelect function to use strict item comparison --- client/app/(dashboard)/components/Table/index.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/app/(dashboard)/components/Table/index.jsx b/client/app/(dashboard)/components/Table/index.jsx index ae5a778e..75c26bbd 100644 --- a/client/app/(dashboard)/components/Table/index.jsx +++ b/client/app/(dashboard)/components/Table/index.jsx @@ -21,7 +21,7 @@ export default function Table({ tabs }) { const setSelectedItems = useDashboardStore(state => state.setSelectedItems); function handleSelect(item) { - if (selectedItems.find(column => isEqual(column, item))) setSelectedItems(selectedItems.filter(selectedRow => selectedRow !== item)); + if (selectedItems.find(column => isEqual(column, item))) setSelectedItems(selectedItems.filter(selectedRow => !isEqual(selectedRow, item))); else setSelectedItems([...selectedItems, item]); }