Skip to content

Commit

Permalink
fix: throw error if duplicate columns
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Oct 16, 2024
1 parent 9dd47fe commit 3a43b86
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 0 additions & 5 deletions examples/sf-specific/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -951,11 +951,6 @@ const deploy: TableOptions<(typeof deployResult)[number]> = {
name: 'Path',
overflow: 'wrap',
},
{
key: 'filePath',
name: 'Path',
overflow: 'wrap',
},
],
data: deployResult,
filter: (row) => row.state === 'Changed' && row.type.startsWith('A'),
Expand Down
6 changes: 6 additions & 0 deletions src/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ function setup<T extends Record<string, unknown>>(props: TableOptions<T>) {

const headings = getHeadings(config)
const columns = getColumns(config, headings)
// check for duplicate columns
const columnKeys = columns.map((c) => c.key)
const duplicates = columnKeys.filter((c, i) => columnKeys.indexOf(c) !== i)
if (duplicates.length > 0) {
throw new Error(`Duplicate columns found: ${duplicates.join(', ')}`)
}

const dataComponent = row<T>({
borderProps,
Expand Down

0 comments on commit 3a43b86

Please sign in to comment.