Skip to content

Commit

Permalink
fix: avoid circular deps when extending default theme + importing fea…
Browse files Browse the repository at this point in the history
…ture components

fix #1210
  • Loading branch information
yyx990803 committed Aug 22, 2022
1 parent bfb0220 commit 5fb7948
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/client/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ export function createApp() {
const data = initData(router.route)
app.provide(dataSymbol, data)

// provide this to avoid circular dependency in VPContent
app.provide('NotFound', NotFound)

// install global components
app.component('Content', Content)
app.component('ClientOnly', ClientOnly)
Expand Down
4 changes: 2 additions & 2 deletions src/client/theme-default/components/VPContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
import { useRoute, useData } from 'vitepress'
import { useCopyCode } from '../composables/copy-code.js'
import { useSidebar } from '../composables/sidebar.js'
import Theme from '@theme/index'
import VPPage from './VPPage.vue'
import VPHome from './VPHome.vue'
import VPDoc from './VPDoc.vue'
import { inject } from 'vue'
const route = useRoute()
const { frontmatter } = useData()
const { hasSidebar } = useSidebar()
const NotFound = Theme.NotFound || (() => '404 Not Found')
const NotFound = inject('NotFound')
useCopyCode()
</script>
Expand Down

0 comments on commit 5fb7948

Please sign in to comment.