Browse Source

fix(gui-v2): if bt/hm cell value is null/undefined treat it as empty array

re #3176

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3181/head
Pranav C 2 years ago
parent
commit
062e2a67cb
  1. 8
      packages/nc-gui-v2/components/virtual-cell/HasMany.vue
  2. 4
      packages/nc-gui-v2/components/virtual-cell/ManyToMany.vue

8
packages/nc-gui-v2/components/virtual-cell/HasMany.vue

@ -49,9 +49,9 @@ await loadRelatedTableMeta()
const localCellValue = computed(() => { const localCellValue = computed(() => {
if (cellValue?.value) { if (cellValue?.value) {
return cellValue?.value return cellValue?.value ?? []
} else if (isNew.value) { } else if (isNew.value) {
return state?.value?.[column?.value.title as string] return state?.value?.[column?.value.title as string] ?? []
} }
return [] return []
}) })
@ -83,8 +83,8 @@ const unlinkRef = async (rec: Record<string, any>) => {
<div class="chips flex align-center img-container flex-grow hm-items flex-nowrap min-w-0 overflow-hidden"> <div class="chips flex align-center img-container flex-grow hm-items flex-nowrap min-w-0 overflow-hidden">
<template v-if="cells"> <template v-if="cells">
<ItemChip v-for="(cell, i) of cells" :key="i" :item="cell.item" :value="cell.value" @unlink="unlinkRef(cell.item)" /> <ItemChip v-for="(cell, i) of cells" :key="i" :item="cell.item" :value="cell.value" @unlink="unlinkRef(cell.item)" />
<span v-if="cellValue?.length === 10" class="caption pointer ml-1 grey--text" @click="childListDlg = true" <span v-if="cellValue?.length === 10" class="caption pointer ml-1 grey--text" @click="childListDlg = true">
>more... more...
</span> </span>
</template> </template>
</div> </div>

4
packages/nc-gui-v2/components/virtual-cell/ManyToMany.vue

@ -49,9 +49,9 @@ await loadRelatedTableMeta()
const localCellValue = computed(() => { const localCellValue = computed(() => {
if (cellValue?.value) { if (cellValue?.value) {
return cellValue?.value return cellValue?.value ?? []
} else if (isNew.value) { } else if (isNew.value) {
return state?.value?.[column?.value.title as string] return state?.value?.[column?.value.title as string] ?? []
} }
return [] return []
}) })

Loading…
Cancel
Save