Browse Source

fix: undefined watchers

pull/6647/head
mertmit 1 year ago
parent
commit
3daee4f886
  1. 6
      packages/nc-gui/store/config.ts

6
packages/nc-gui/store/config.ts

@ -7,7 +7,9 @@ export const useConfigStore = defineStore('configStore', () => {
const sidebarStore = useSidebarStore() const sidebarStore = useSidebarStore()
const viewsStore = useViewsStore() const viewsStore = useViewsStore()
const { activeViewTitleOrId } = storeToRefs(viewsStore)
const tablesStore = useTablesStore() const tablesStore = useTablesStore()
const { activeTableId } = storeToRefs(tablesStore)
const isViewPortMobile = () => width.value < MAX_WIDTH_FOR_MOBILE_MODE const isViewPortMobile = () => width.value < MAX_WIDTH_FOR_MOBILE_MODE
@ -47,7 +49,7 @@ export const useConfigStore = defineStore('configStore', () => {
const handleSidebarOpenOnMobileForNonViews = () => { const handleSidebarOpenOnMobileForNonViews = () => {
if (!isViewPortMobile()) return if (!isViewPortMobile()) return
if (!viewsStore.activeViewTitleOrId && !tablesStore.activeTableId) { if (!activeViewTitleOrId && !activeTableId) {
nextTick(() => { nextTick(() => {
sidebarStore.isLeftSidebarOpen = true sidebarStore.isLeftSidebarOpen = true
}) })
@ -56,7 +58,7 @@ export const useConfigStore = defineStore('configStore', () => {
} }
} }
watch([viewsStore.activeViewTitleOrId, tablesStore.activeTableId], () => { watch([activeViewTitleOrId, activeTableId], () => {
handleSidebarOpenOnMobileForNonViews() handleSidebarOpenOnMobileForNonViews()
}) })

Loading…
Cancel
Save