Skip to content

Commit

Permalink
Refactor handleSelect function to use strict item comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
chimpdev committed Sep 14, 2024
1 parent 5f1967c commit 23688f8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion client/app/(dashboard)/components/Table/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}

Expand Down

0 comments on commit 23688f8

Please sign in to comment.