Skip to content
This repository has been archived by the owner on May 24, 2024. It is now read-only.

Commit

Permalink
Resolve test file issue
Browse files Browse the repository at this point in the history
  • Loading branch information
cm9361 committed Nov 20, 2023
1 parent cccac2c commit 2b04ef1
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,18 @@ const TableSingleRowSelection = () => {
const [rowData, setRowData] = useState(rows);

const onRowSelect = useCallback((rowId) => {
// Remove current selections
const newRowData = [...rowData];

const dataRowToUpdate = newRowData.find(row => row.id === rowId);
if (dataRowToUpdate) {
dataRowToUpdate.isSelected = !dataRowToUpdate.isSelected;
}

newRowData.forEach((row) => {
if (row.id !== dataRowToUpdate.id) {
// eslint-disable-next-line no-return-assign, no-param-reassign
row.isSelected = false;
}
});

dataRowToUpdate.isSelected = !dataRowToUpdate.isSelected;

setRowData(newRowData);
}, [rowData]);
Expand Down

0 comments on commit 2b04ef1

Please sign in to comment.