Browse Source

fix(gui): avoid rendering cell component while switching tab

- to avoid passing wrong(previous tabs data) data to cell

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/4405/head
Pranav C 2 years ago
parent
commit
e074b6338e
  1. 7
      packages/nc-gui/components/smartsheet/Grid.vue

7
packages/nc-gui/components/smartsheet/Grid.vue

@ -521,11 +521,14 @@ provide(ReloadRowDataHookInj, reloadViewDataHook)
// trigger initial data load in grid // trigger initial data load in grid
// reloadViewDataHook.trigger() // reloadViewDataHook.trigger()
const switchingTab = ref(false)
watch( watch(
view, view,
async (next, old) => { async (next, old) => {
try { try {
if (next && next.id !== old?.id) { if (next && next.id !== old?.id) {
switchingTab.value = true
// whenever tab changes or view changes save any unsaved data // whenever tab changes or view changes save any unsaved data
if (old?.id) { if (old?.id) {
const oldMeta = await getMeta(old.fk_model_id!) const oldMeta = await getMeta(old.fk_model_id!)
@ -541,6 +544,8 @@ watch(
} }
} catch (e) { } catch (e) {
console.log(e) console.log(e)
} finally {
switchingTab.value = false
} }
}, },
{ immediate: true }, { immediate: true },
@ -707,7 +712,7 @@ watch(
@mouseover="selectBlock(rowIndex, colIndex)" @mouseover="selectBlock(rowIndex, colIndex)"
@contextmenu="showContextMenu($event, { row: rowIndex, col: colIndex })" @contextmenu="showContextMenu($event, { row: rowIndex, col: colIndex })"
> >
<div class="w-full h-full"> <div class="w-full h-full" v-if="!switchingTab">
<LazySmartsheetVirtualCell <LazySmartsheetVirtualCell
v-if="isVirtualCol(columnObj)" v-if="isVirtualCol(columnObj)"
v-model="row.row[columnObj.title]" v-model="row.row[columnObj.title]"

Loading…
Cancel
Save