Browse Source

refactor(gui-v2): remove unused import, rename variable

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/2934/head
Pranav C 2 years ago
parent
commit
296309d291
  1. 3
      packages/nc-gui-v2/components/smartsheet/sidebar/MenuTop.vue
  2. 8
      packages/nc-gui-v2/components/smartsheet/sidebar/index.vue

3
packages/nc-gui-v2/components/smartsheet/sidebar/MenuTop.vue

@ -6,11 +6,8 @@ import { notification } from 'ant-design-vue'
import type { Ref } from 'vue' import type { Ref } from 'vue'
import Sortable from 'sortablejs' import Sortable from 'sortablejs'
import RenameableMenuItem from './RenameableMenuItem.vue' import RenameableMenuItem from './RenameableMenuItem.vue'
import { Meta } from '#head/components'
import { inject, onMounted, ref, useApi, useTabs, watch } from '#imports' import { inject, onMounted, ref, useApi, useTabs, watch } from '#imports'
import { extractSdkResponseErrorMsg } from '~/utils' import { extractSdkResponseErrorMsg } from '~/utils'
import type { TabItem } from '~/composables/useTabs'
import { TabType } from '~/composables/useTabs'
import { ActiveViewInj, MetaInj, ViewListInj } from '~/context' import { ActiveViewInj, MetaInj, ViewListInj } from '~/context'
interface Emits { interface Emits {

8
packages/nc-gui-v2/components/smartsheet/sidebar/index.vue

@ -37,16 +37,16 @@ let modalOpen = $ref(false)
/** Watch route param and change active view based on `viewTitle` */ /** Watch route param and change active view based on `viewTitle` */
watch( watch(
[views, () => route.params.viewTitle], [views, () => route.params.viewTitle],
([views, viewTitle]) => { ([nextViews, viewTitle]) => {
if (viewTitle) { if (viewTitle) {
const view = views.find((v) => v.title === viewTitle) const view = nextViews.find((v) => v.title === viewTitle)
if (view) { if (view) {
activeView.value = view activeView.value = view
} }
} }
/** if active view is not found, set it to first view */ /** if active view is not found, set it to first view */
if (!activeView.value && views.length) { if (!activeView.value && nextViews.length) {
activeView.value = views[0] activeView.value = nextViews[0]
} }
}, },
{ immediate: true }, { immediate: true },

Loading…
Cancel
Save