Browse Source

fix(gui): reload related table meta on LTAR column delete

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3569/head
Pranav C 2 years ago
parent
commit
2e7c322ec5
  1. 8
      packages/nc-gui/components/smartsheet-header/Menu.vue

8
packages/nc-gui/components/smartsheet-header/Menu.vue

@ -1,5 +1,7 @@
<script lang="ts" setup>
import { Modal, message } from 'ant-design-vue'
import type { LinkToAnotherRecordType } from 'nocodb-sdk'
import { UITypes } from 'nocodb-sdk'
import { ColumnInj, IsLockedInj, MetaInj, extractSdkResponseErrorMsg, inject, useI18n, useMetas, useNuxtApp } from '#imports'
const { virtual = false } = defineProps<{ virtual?: boolean }>()
@ -29,6 +31,12 @@ const deleteColumn = () =>
await $api.dbTableColumn.delete(column?.value?.id as string)
await getMeta(meta?.value?.id as string, true)
/** force-reload related table meta if deleted column is a LTAR and not linked to same table */
if (column?.value?.uidt === UITypes.LinkToAnotherRecord && column.value?.colOptions) {
await getMeta((column.value?.colOptions as LinkToAnotherRecordType).fk_related_model_id!, true)
}
$e('a:column:delete')
} catch (e: any) {
message.error(await extractSdkResponseErrorMsg(e))

Loading…
Cancel
Save