Don't allow unselecting last column

This commit is contained in:
Laurent Nguyen 2024-07-11 10:04:43 +02:00
parent ea2ab19518
commit 9efbe7d056

View File

@ -35,6 +35,10 @@ export const TableColumnSelectionPane: React.FC<TableColumnSelectionPaneProps> =
if (checked) { if (checked) {
selectedColumnIdsSet.add(id); selectedColumnIdsSet.add(id);
} else { } else {
if (selectedColumnIdsSet.size === 1 && selectedColumnIdsSet.has(id)) {
// Don't allow unchecking the last column
return;
}
selectedColumnIdsSet.delete(id); selectedColumnIdsSet.delete(id);
} }
setNewSelectedColumnIds([...selectedColumnIdsSet]); setNewSelectedColumnIds([...selectedColumnIdsSet]);