Skip to content

Commit 2ee49d3

Browse files
committedJan 15, 2025·
fix(theme-default): fix header provide
1 parent fc98b5e commit 2ee49d3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
 

‎themes/theme-default/src/client/composables/useHeaders.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { useThemeLocaleData } from '@theme/useThemeData'
22
import type { MenuItem } from '@vuepress/helper/client'
33
import { getHeaders } from '@vuepress/helper/client'
4-
import { watchImmediate } from '@vueuse/core'
4+
import { injectLocal, provideLocal, watchImmediate } from '@vueuse/core'
55
import type { InjectionKey, Ref } from 'vue'
6-
import { computed, inject, onMounted, provide, ref } from 'vue'
6+
import { computed, onMounted, ref } from 'vue'
77
import { usePageFrontmatter, useRoutePath } from 'vuepress/client'
88
import type { DefaultThemeNormalPageFrontmatter } from '../../shared/index.js'
99

@@ -15,7 +15,7 @@ export const headersSymbol: InjectionKey<HeadersRef> = Symbol('headers')
1515
* Inject headers
1616
*/
1717
export const useHeaders = (): HeadersRef => {
18-
const headers = inject(headersSymbol)
18+
const headers = injectLocal(headersSymbol)
1919

2020
if (!headers) {
2121
throw new Error('useHeaders() is called without provider.')
@@ -45,7 +45,7 @@ export const setupHeaders = (): void => {
4545
})
4646
}
4747

48-
provide(headersSymbol, headersRef)
48+
provideLocal(headersSymbol, headersRef)
4949

5050
onMounted(() => {
5151
watchImmediate([levels, routePath], updateHeaders)

0 commit comments

Comments
 (0)
Please sign in to comment.