Skip to content

Commit ffe754d

Browse files
waleedlatif1claude
andcommitted
fix(tables): only multi-delete when clicked column is within selection
Check that the right-clicked column is within the selected column range before using multi-column delete. If the click is outside the selection, delete only the clicked column. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0fd6fa9 commit ffe754d

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table

apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table/table.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,13 +1754,16 @@ export function Table({
17541754
if (isColumnSelectionRef.current && selectionAnchorRef.current) {
17551755
const sel = computeNormalizedSelection(selectionAnchorRef.current, selectionFocusRef.current)
17561756
if (sel && sel.startCol !== sel.endCol) {
1757-
const names: string[] = []
1758-
for (let c = sel.startCol; c <= sel.endCol; c++) {
1759-
if (c < cols.length) names.push(cols[c].name)
1760-
}
1761-
if (names.length > 0) {
1762-
setDeletingColumns(names)
1763-
return
1757+
const clickedIdx = cols.findIndex((c) => c.name === columnName)
1758+
if (clickedIdx >= sel.startCol && clickedIdx <= sel.endCol) {
1759+
const names: string[] = []
1760+
for (let c = sel.startCol; c <= sel.endCol; c++) {
1761+
if (c < cols.length) names.push(cols[c].name)
1762+
}
1763+
if (names.length > 0) {
1764+
setDeletingColumns(names)
1765+
return
1766+
}
17641767
}
17651768
}
17661769
}

0 commit comments

Comments
 (0)