Browse Source

fix: make sure at least one pk is valid while extracting composite pk

pull/8371/head
mertmit 6 months ago
parent
commit
d24de3ffe1
  1. 11
      packages/nc-gui/utils/dataUtils.ts

11
packages/nc-gui/utils/dataUtils.ts

@ -5,11 +5,12 @@ import type { Row } from '~/lib'
export const extractPkFromRow = (row: Record<string, any>, columns: ColumnType[]) => {
if (!row || !columns) return null
return columns
.filter((c) => c.pk)
.map((c) => row?.[c.title as string])
.filter((v) => v)
.join('___')
const pkColumns = columns.filter((c) => c.pk)
if (!pkColumns.some((c) => row?.[c.title as string])) return null
return pkColumns.map((c) => row?.[c.title as string]).join('___')
}
export const rowPkData = (row: Record<string, any>, columns: ColumnType[]) => {

Loading…
Cancel
Save