From e074b6338e8170e6bb28247d534173b4ecf5c44c Mon Sep 17 00:00:00 2001 From: Pranav C Date: Wed, 16 Nov 2022 15:14:54 +0530 Subject: [PATCH] fix(gui): avoid rendering cell component while switching tab - to avoid passing wrong(previous tabs data) data to cell Signed-off-by: Pranav C --- packages/nc-gui/components/smartsheet/Grid.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 })" > -
+