From 25d47c1dcae4e9ac33e426298f4086da70d6f590 Mon Sep 17 00:00:00 2001 From: mertmit Date: Sun, 28 Aug 2022 21:04:46 +0300 Subject: [PATCH] fix: use columnsById instead of find in fields Signed-off-by: mertmit --- packages/nc-gui-v2/components/smartsheet/Gallery.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui-v2/components/smartsheet/Gallery.vue b/packages/nc-gui-v2/components/smartsheet/Gallery.vue index 17143a9abe..fc8ab9e6bf 100644 --- a/packages/nc-gui-v2/components/smartsheet/Gallery.vue +++ b/packages/nc-gui-v2/components/smartsheet/Gallery.vue @@ -49,7 +49,13 @@ provide(ReadonlyInj, !isUIAllowed('xcDatatableEditable')) const fields = inject(FieldsInj, ref([])) -const coverImageColumn = $(computed(() => fields.value.find((col) => col.id === galleryData.value?.fk_cover_image_col_id))) +const coverImageColumn: any = $( + computed(() => + meta?.value.columnsById + ? meta.value.columnsById[galleryData.value?.fk_cover_image_col_id as keyof typeof meta.value.columnsById] + : {}, + ), +) watch( [meta, view], @@ -71,7 +77,7 @@ const isRowEmpty = (record: any, col: any) => { const attachments = (record: any): Array => { try { - return JSON.parse(record.row[coverImageColumn?.title]) ?? [] + return coverImageColumn?.title ? JSON.parse(record.row[coverImageColumn.title]) : [] } catch (e) { return [] }