From 7b7f87c851ce21ecc0d80cfb9492ed5da3496eac Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 25 Aug 2022 17:53:44 +0530 Subject: [PATCH] fix(gui-v2): insert view column even if fields array is empty Signed-off-by: Pranav C --- packages/nc-gui-v2/composables/useViewColumns.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/nc-gui-v2/composables/useViewColumns.ts b/packages/nc-gui-v2/composables/useViewColumns.ts index ac1da0e890..472b8af703 100644 --- a/packages/nc-gui-v2/composables/useViewColumns.ts +++ b/packages/nc-gui-v2/composables/useViewColumns.ts @@ -135,7 +135,12 @@ export function useViewColumns(view: Ref | undefined, meta: ComputedRe if (field.id && view?.value?.id) { await $api.dbViewColumn.update(view.value.id, field.id, field) } else if (view?.value?.id) { - if (fields.value) fields.value[index] = (await $api.dbViewColumn.create(view.value.id, field)) as any + const insertedField = (await $api.dbViewColumn.create(view.value.id, field)) as any + + /** update the field in fields if defined */ + if (fields.value) fields.value[index] = insertedField + + return insertedField } }