diff --git a/packages/nc-gui/components/smartsheet/Grid.vue b/packages/nc-gui/components/smartsheet/Grid.vue index 5a4595e7bb..1940aada59 100644 --- a/packages/nc-gui/components/smartsheet/Grid.vue +++ b/packages/nc-gui/components/smartsheet/Grid.vue @@ -768,7 +768,7 @@ onBeforeUnmount(async () => { const viewMetaValue = view.value const dataValue = data.value if (viewMetaValue) { - getMeta(viewMetaValue.fk_model_id).then((res) => { + getMeta(viewMetaValue.fk_model_id, false, true).then((res) => { const metaValue = res if (!metaValue) return saveOrUpdateRecords({ @@ -815,7 +815,7 @@ watch( switchingTab.value = true // whenever tab changes or view changes save any unsaved data if (old?.id) { - const oldMeta = await getMeta(old.fk_model_id!) + const oldMeta = await getMeta(old.fk_model_id!, false, true) if (oldMeta) { await saveOrUpdateRecords({ viewMetaValue: old, diff --git a/packages/nc-gui/composables/useMetas.ts b/packages/nc-gui/composables/useMetas.ts index 72cde33128..31f7931519 100644 --- a/packages/nc-gui/composables/useMetas.ts +++ b/packages/nc-gui/composables/useMetas.ts @@ -26,7 +26,7 @@ export function useMetas() { } // todo: this needs a proper refactor, arbitrary waiting times are usually not a good idea - const getMeta = async (tableIdOrTitle: string, force = false): Promise => { + const getMeta = async (tableIdOrTitle: string, force = false, skipIfCacheMiss = false): Promise => { if (!tableIdOrTitle) return null /** wait until loading is finished if requesting same meta */ if (!force && loadingState.value[tableIdOrTitle]) { @@ -58,6 +58,7 @@ export function useMetas() { return metas.value[tableIdOrTitle] } } + if (skipIfCacheMiss) return null loadingState.value[tableIdOrTitle] = true