Browse Source

fix(nc-gui): check if col exists in lookup cmp

pull/3847/head
braks 2 years ago
parent
commit
fc7fdb1ee7
  1. 7
      packages/nc-gui/components/virtual-cell/Lookup.vue

7
packages/nc-gui/components/virtual-cell/Lookup.vue

@ -1,7 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import type { ColumnType, LinkToAnotherRecordType, LookupType } from 'nocodb-sdk' import type { ColumnType, LinkToAnotherRecordType, LookupType } from 'nocodb-sdk'
import { RelationTypes, UITypes, isVirtualCol } from 'nocodb-sdk' import { RelationTypes, UITypes, isVirtualCol } from 'nocodb-sdk'
import type { Ref } from 'vue'
import { import {
CellUrlDisableOverlayInj, CellUrlDisableOverlayInj,
CellValueInj, CellValueInj,
@ -22,7 +21,7 @@ const { metas, getMeta } = useMetas()
provide(ReadonlyInj, ref(true)) provide(ReadonlyInj, ref(true))
const column = inject(ColumnInj)! as Ref<ColumnType & { colOptions: LookupType }> const column = inject(ColumnInj)
const meta = inject(MetaInj, ref()) const meta = inject(MetaInj, ref())
@ -32,7 +31,7 @@ const arrValue = computed(() => (Array.isArray(value?.value) ? value?.value : [v
const relationColumn = computed( const relationColumn = computed(
() => () =>
meta.value?.columns?.find((c) => c.id === column.value.colOptions?.fk_relation_column_id) as ColumnType & { meta.value?.columns?.find((c) => c.id === (column?.value.colOptions as LookupType)?.fk_relation_column_id) as ColumnType & {
colOptions: LinkToAnotherRecordType colOptions: LinkToAnotherRecordType
}, },
) )
@ -50,7 +49,7 @@ const lookupTableMeta = computed(() => metas.value[relationColumn.value.colOptio
const lookupColumn = computed<any>( const lookupColumn = computed<any>(
() => () =>
lookupTableMeta.value.columns?.find( lookupTableMeta.value.columns?.find(
(c: Record<string, any>) => c.id === column.value.colOptions?.fk_lookup_column_id, (c: Record<string, any>) => c.id === (column?.value.colOptions as LookupType)?.fk_lookup_column_id,
) as ColumnType, ) as ColumnType,
) )

Loading…
Cancel
Save