Browse Source

refactor: optimize tab reload on tab switch

re #767

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/764/head
Pranav C 3 years ago
parent
commit
6358a4bc39
  1. 10
      packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue
  2. 4
      packages/nc-gui/components/project/table.vue
  3. 2
      packages/nc-gui/components/projectTabs.vue

10
packages/nc-gui/components/project/spreadsheet/rowsXcDataTable.vue

@ -583,6 +583,7 @@ export default {
},
mixins: [spreadsheet],
props: {
isActive: Boolean,
tabId: String,
env: String,
nodes: Object,
@ -670,6 +671,11 @@ export default {
rowContextMenu: null
}),
watch: {
isActive(n, o) {
if (!o && n) {
this.reload()
}
},
page(p) {
this.$store.commit('tabs/MutSetTabState', {
id: this.uniqueId,
@ -1159,7 +1165,9 @@ export default {
}
},
computed: {
tabsState() { return this.$store.state.tabs.tabsState || {} },
tabsState() {
return this.$store.state.tabs.tabsState || {}
},
uniqueId() {
return `${this.tabId}_${this.selectedViewId}`
},

4
packages/nc-gui/components/project/table.vue

@ -317,6 +317,7 @@
>
<rows-xc-data-table
ref="tabs7"
:is-active="isActive"
:tab-id="tabId"
:show-tabs="relationTabs && relationTabs.length"
:table="nodes.tn"
@ -384,6 +385,7 @@
<template>
<rows-xc-data-table
ref="tabs7"
:is-active="isActive"
:show-tabs="relationTabs && relationTabs.length"
:table="nodes.tn"
:nodes="nodes"
@ -639,7 +641,7 @@ export default {
head() {
return {}
},
props: ['nodes', 'hideLogWindows', 'tabId']
props: ['nodes', 'hideLogWindows', 'tabId', 'isActive']
}
</script>

2
packages/nc-gui/components/projectTabs.vue

@ -61,8 +61,8 @@
>
<!-- <sqlLogAndOutput :hide="hideLogWindows">-->
<TableView
v-if="activeTab === `${(tab._nodes && tab._nodes).type || ''}||${(tab._nodes && tab._nodes.dbAlias) || ''}||${tab.name}`"
:ref="'tabs'+index"
:is-active="activeTab === `${(tab._nodes && tab._nodes).type || ''}||${(tab._nodes && tab._nodes.dbAlias) || ''}||${tab.name}`"
:tab-id="`${pid}||${(tab._nodes && tab._nodes).type || ''}||${(tab._nodes && tab._nodes.dbAlias) || ''}||${tab.name}`"
:hide-log-windows.sync="hideLogWindows"
:nodes="tab._nodes"

Loading…
Cancel
Save