From 6a5e7580e60673ae0c57bcb884a75b5029315461 Mon Sep 17 00:00:00 2001 From: mertmit Date: Mon, 8 May 2023 07:59:07 +0300 Subject: [PATCH] fix: reload table list on mm delete with includeM2M Signed-off-by: mertmit --- packages/nc-gui/components/smartsheet/header/Menu.vue | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/nc-gui/components/smartsheet/header/Menu.vue b/packages/nc-gui/components/smartsheet/header/Menu.vue index 9f1f909ca0..2bd2acc4d2 100644 --- a/packages/nc-gui/components/smartsheet/header/Menu.vue +++ b/packages/nc-gui/components/smartsheet/header/Menu.vue @@ -14,9 +14,11 @@ import { iconMap, inject, message, + useGlobal, useI18n, useMetas, useNuxtApp, + useProject, useSmartsheetStoreOrThrow, useUndoRedo, } from '#imports' @@ -28,6 +30,10 @@ const emit = defineEmits(['edit', 'addColumn']) const { eventBus } = useSmartsheetStoreOrThrow() +const { includeM2M } = useGlobal() + +const { loadTables } = useProject() + const column = inject(ColumnInj) const reloadDataHook = inject(ReloadViewDataHookInj) @@ -62,6 +68,11 @@ const deleteColumn = () => /** 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) + + // reload tables if deleted column is mm and include m2m is true + if (includeM2M.value && (column.value?.colOptions as LinkToAnotherRecordType).type === RelationTypes.MANY_TO_MANY) { + loadTables() + } } $e('a:column:delete')