workaround for #2796 is no longer needed, was fixed in core

pull/4673/head
Divyansh Singh 6 months ago
parent 8eb759a586
commit a02db2b3bc

@ -1,6 +1,6 @@
import { useMediaQuery } from '@vueuse/core' import { useMediaQuery } from '@vueuse/core'
import { onContentUpdated } from 'vitepress' import { onContentUpdated } from 'vitepress'
import { computed, ref, shallowRef, watch } from 'vue' import { computed, shallowRef } from 'vue'
import type { MenuItem } from '../../shared' import type { MenuItem } from '../../shared'
import { getSidebar, getSidebarGroups } from '../support/sidebar' import { getSidebar, getSidebarGroups } from '../support/sidebar'
import { useData } from './data' import { useData } from './data'
@ -14,19 +14,12 @@ export function useLayout() {
return !!(frontmatter.value.isHome ?? frontmatter.value.layout === 'home') return !!(frontmatter.value.isHome ?? frontmatter.value.layout === 'home')
}) })
const _sidebar = computed(() => { const sidebar = computed(() => {
const sidebarConfig = theme.value.sidebar const sidebarConfig = theme.value.sidebar
const relativePath = page.value.relativePath const relativePath = page.value.relativePath
return sidebarConfig ? getSidebar(sidebarConfig, relativePath) : [] return sidebarConfig ? getSidebar(sidebarConfig, relativePath) : []
}) })
const sidebar = ref(_sidebar.value)
watch(_sidebar, (next, prev) => {
if (JSON.stringify(next) !== JSON.stringify(prev))
sidebar.value = _sidebar.value
})
const hasSidebar = computed(() => { const hasSidebar = computed(() => {
return ( return (
frontmatter.value.sidebar !== false && frontmatter.value.sidebar !== false &&

Loading…
Cancel
Save