Skip to content

Commit 1825636

Browse files
Mister-Hopemeteorlxy
andauthoredApr 15, 2024··
fix(client): fix siteLocaleData type (#1529)
Co-authored-by: Xinyu Liu <meteor.lxy@foxmail.com>
1 parent a33ca46 commit 1825636

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed
 

‎packages/client/src/resolvers.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,15 @@ export const resolvers = reactive({
103103
* It would merge the locales fields to the root fields
104104
*/
105105
resolveSiteLocaleData: (
106-
siteData: SiteData,
106+
{ base, locales, ...siteData }: SiteData,
107107
routeLocale: RouteLocale,
108108
): SiteLocaleData => ({
109109
...siteData,
110-
...siteData.locales[routeLocale],
110+
...locales[routeLocale],
111111
head: [
112112
// when merging head, the locales head should be placed before root head
113113
// to get higher priority
114-
...(siteData.locales[routeLocale]?.head ?? []),
114+
...(locales[routeLocale]?.head ?? []),
115115
...(siteData.head ?? []),
116116
],
117117
}),

‎packages/client/src/types/clientData.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type {
44
PageFrontmatter,
55
PageHeader,
66
SiteData,
7+
SiteLocaleData,
78
} from '@vuepress/shared'
89
import type { Component, ComputedRef, Ref } from 'vue'
910
import type {
@@ -12,7 +13,14 @@ import type {
1213
} from '../constants.js'
1314
import type { Redirects, Routes } from './routes.js'
1415

15-
export type { HeadConfig, PageData, PageFrontmatter, PageHeader, SiteData }
16+
export type {
17+
HeadConfig,
18+
PageData,
19+
PageFrontmatter,
20+
PageHeader,
21+
SiteData,
22+
SiteLocaleData,
23+
}
1624

1725
export interface Layouts {
1826
[LAYOUT_NAME_DEFAULT]: Component
@@ -26,7 +34,6 @@ export type PageLang = string
2634
export type PageLayout = Component
2735
export type RoutePath = string
2836
export type RouteLocale = string
29-
export type SiteLocaleData = SiteData
3037

3138
export type LayoutsRef = ComputedRef<Layouts>
3239
export type PageComponentRef = ComputedRef<PageComponent>

0 commit comments

Comments
 (0)
Please sign in to comment.