diff --git a/packages/nc-gui/components/smartsheet/Grid.vue b/packages/nc-gui/components/smartsheet/Grid.vue index 5dd1569e1c..03fe973f6e 100644 --- a/packages/nc-gui/components/smartsheet/Grid.vue +++ b/packages/nc-gui/components/smartsheet/Grid.vue @@ -521,11 +521,14 @@ provide(ReloadRowDataHookInj, reloadViewDataHook) // trigger initial data load in grid // reloadViewDataHook.trigger() +const switchingTab = ref(false) + watch( view, async (next, old) => { try { if (next && next.id !== old?.id) { + switchingTab.value = true // whenever tab changes or view changes save any unsaved data if (old?.id) { const oldMeta = await getMeta(old.fk_model_id!) @@ -541,6 +544,8 @@ watch( } } catch (e) { console.log(e) + } finally { + switchingTab.value = false } }, { immediate: true }, @@ -707,7 +712,7 @@ watch( @mouseover="selectBlock(rowIndex, colIndex)" @contextmenu="showContextMenu($event, { row: rowIndex, col: colIndex })" > -