Browse Source

fix(gui-v2): insert view column even if fields array is empty

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3310/head
Pranav C 2 years ago
parent
commit
7b7f87c851
  1. 7
      packages/nc-gui-v2/composables/useViewColumns.ts

7
packages/nc-gui-v2/composables/useViewColumns.ts

@ -135,7 +135,12 @@ export function useViewColumns(view: Ref<ViewType> | undefined, meta: ComputedRe
if (field.id && view?.value?.id) { if (field.id && view?.value?.id) {
await $api.dbViewColumn.update(view.value.id, field.id, field) await $api.dbViewColumn.update(view.value.id, field.id, field)
} else if (view?.value?.id) { } 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
} }
} }

Loading…
Cancel
Save