Browse Source

fix(nc-gui): check if table exists before adding edge

pull/4066/head
braks 2 years ago
parent
commit
41ddf66c8c
  1. 5
      packages/nc-gui/components/erd/utils.ts

5
packages/nc-gui/components/erd/utils.ts

@ -101,6 +101,11 @@ export function useErdElements(tables: MaybeRef<TableType[]>, props: MaybeRef<Er
const source = column.fk_model_id! const source = column.fk_model_id!
const target = (column.colOptions as LinkToAnotherRecordType).fk_related_model_id! const target = (column.colOptions as LinkToAnotherRecordType).fk_related_model_id!
const hasSource = erdTables.value.find((table) => table.id === source)
const hasTarget = erdTables.value.find((table) => table.id === target)
if (!hasSource || !hasTarget) return acc
let sourceColumnId, targetColumnId let sourceColumnId, targetColumnId
let edgeLabel = '' let edgeLabel = ''

Loading…
Cancel
Save