Browse Source

fix: review change - extractPk

pull/7389/head
Ramesh Mane 10 months ago
parent
commit
02eb9139bf
  1. 1
      packages/nc-gui/composables/useData.ts
  2. 6
      packages/nc-gui/utils/dataUtils.ts

1
packages/nc-gui/composables/useData.ts

@ -4,6 +4,7 @@ import type { ComputedRef, Ref } from 'vue'
import {
NOCO,
computed,
extractPk,
extractPkFromRow,
extractSdkResponseErrorMsg,
findIndexByPk,

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

@ -24,8 +24,10 @@ export const rowPkData = (row: Record<string, any>, columns: ColumnType[]) => {
export const extractPk = (columns: ColumnType[]) => {
if (!columns && !Array.isArray(columns)) return null
const pkData = columns?.find((c) => c.pk)
return pkData ? pkData?.title || pkData?.column_name : null
return columns
.filter((c) => c.pk)
.map((c) => c.title)
.join('___')
}
export const findIndexByPk = (pk: Record<string, string>, data: Row[]) => {

Loading…
Cancel
Save