1
1
import { useThemeLocaleData } from '@theme/useThemeData'
2
2
import type { MenuItem } from '@vuepress/helper/client'
3
3
import { getHeaders } from '@vuepress/helper/client'
4
- import { watchImmediate } from '@vueuse/core'
4
+ import { injectLocal , provideLocal , watchImmediate } from '@vueuse/core'
5
5
import type { InjectionKey , Ref } from 'vue'
6
- import { computed , inject , onMounted , provide , ref } from 'vue'
6
+ import { computed , onMounted , ref } from 'vue'
7
7
import { usePageFrontmatter , useRoutePath } from 'vuepress/client'
8
8
import type { DefaultThemeNormalPageFrontmatter } from '../../shared/index.js'
9
9
@@ -15,7 +15,7 @@ export const headersSymbol: InjectionKey<HeadersRef> = Symbol('headers')
15
15
* Inject headers
16
16
*/
17
17
export const useHeaders = ( ) : HeadersRef => {
18
- const headers = inject ( headersSymbol )
18
+ const headers = injectLocal ( headersSymbol )
19
19
20
20
if ( ! headers ) {
21
21
throw new Error ( 'useHeaders() is called without provider.' )
@@ -45,7 +45,7 @@ export const setupHeaders = (): void => {
45
45
} )
46
46
}
47
47
48
- provide ( headersSymbol , headersRef )
48
+ provideLocal ( headersSymbol , headersRef )
49
49
50
50
onMounted ( ( ) => {
51
51
watchImmediate ( [ levels , routePath ] , updateHeaders )
0 commit comments