Skip to content

Commit cc389c0

Browse files
committed
setStaticParamsLocale build fixes
1 parent 5354075 commit cc389c0

File tree

20 files changed

+86
-27
lines changed

20 files changed

+86
-27
lines changed

src/app/[countryCode]/(checkout)/checkout/page.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { cookies } from "next/headers"
33
import { notFound } from "next/navigation"
44
import { Cart, LineItem } from "@medusajs/medusa"
55

6-
import { getI18n } from "../../../../locales/server"
6+
import { getI18n, setStaticParams, getCurrentLocale } from "../../../../locales/server"
77

88
import { enrichLineItems } from "@modules/cart/actions"
99
import Wrapper from "@modules/checkout/components/payment-wrapper"
@@ -15,6 +15,10 @@ export const metadata: Metadata = {
1515
title: "checkout.title",
1616
}
1717

18+
type Props = {
19+
params: { countryCode: string; }
20+
}
21+
1822
const fetchCart = async () => {
1923
const cartId = cookies().get("_medusa_cart_id")?.value
2024

@@ -32,7 +36,8 @@ const fetchCart = async () => {
3236
return cart
3337
}
3438

35-
export default async function Checkout() {
39+
export default async function Checkout({ params }: Props) {
40+
setStaticParams(params.countryCode)
3641
const t = await getI18n()
3742
metadata.title = t("checkout.title")
3843

src/app/[countryCode]/(checkout)/layout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ import LocalizedClientLink from "@modules/common/components/localized-client-lin
22
import ChevronDown from "@modules/common/icons/chevron-down"
33
import MedusaCTA from "@modules/layout/components/medusa-cta"
44

5-
import { getI18n } from "../../../locales/server"
5+
import { getI18n, getCurrentLocale, setStaticParams, getStaticParams } from "../../../locales/server"
66

77
export default async function CheckoutLayout({
88
children,
99
}: {
1010
children: React.ReactNode
1111
}) {
12+
setStaticParams(getCurrentLocale());
1213
const t = await getI18n()
1314

1415
return (

src/app/[countryCode]/(checkout)/not-found.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { getI18n } from "../../../locales/server"
1+
import { getI18n, getCurrentLocale, getStaticParams, setStaticParams } from "../../../locales/server"
2+
23
import InteractiveLink from "@modules/common/components/interactive-link"
34
import { Metadata } from "next"
45

@@ -8,6 +9,7 @@ export const metadata: Metadata = {
89
}
910

1011
export default async function NotFound() {
12+
setStaticParams(getCurrentLocale())
1113
const t = await getI18n()
1214

1315
metadata.description = t("generic.somethingwrong")

src/app/[countryCode]/(main)/account/@dashboard/addresses/page.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Metadata } from "next"
22
import { notFound } from "next/navigation"
33

4-
import { getI18n } from "../../../../../../locales/server"
4+
import { getI18n, setStaticParams } from "../../../../../../locales/server"
55

66
import AddressBook from "@modules/account/components/address-book"
77

@@ -14,7 +14,12 @@ export const metadata: Metadata = {
1414
description: "page.adresses.desc",
1515
}
1616

17-
export default async function Addresses() {
17+
type Props = {
18+
params: { countryCode: string; }
19+
}
20+
21+
export default async function Addresses({ params }: Props) {
22+
setStaticParams(params.countryCode)
1823
const t = await getI18n()
1924
metadata.title = t("page.adresses.title")
2025
metadata.description = t("page.adresses.desc")

src/app/[countryCode]/(main)/account/@dashboard/orders/details/[id]/page.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import { Metadata } from "next"
22
import { notFound } from "next/navigation"
33

4-
import { getI18n } from "../../../../../../../../locales/server"
4+
import { getI18n, setStaticParams } from "../../../../../../../../locales/server"
55

66
import { retrieveOrder } from "@lib/data"
77
import OrderDetailsTemplate from "@modules/order/templates/order-details-template"
88

99
type Props = {
10-
params: { id: string }
10+
params: { countryCode: string; id: string }
1111
}
1212

1313
export async function generateMetadata({ params }: Props): Promise<Metadata> {
14+
setStaticParams(params.countryCode)
1415
const t = await getI18n()
1516
const order = await retrieveOrder(params.id).catch(() => null)
1617

src/app/[countryCode]/(main)/account/@dashboard/orders/page.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Metadata } from "next"
22

3-
import { getI18n } from "../../../../../../locales/server"
3+
import { getI18n, setStaticParams } from "../../../../../../locales/server"
44

55
import OrderOverview from "@modules/account/components/order-overview"
66
import { listCustomerOrders } from "@lib/data"
@@ -11,7 +11,12 @@ export const metadata: Metadata = {
1111
description: "page.orders.desc",
1212
}
1313

14-
export default async function Orders() {
14+
type Props = {
15+
params: { countryCode: string; }
16+
}
17+
18+
export default async function Orders({ params }: Props) {
19+
setStaticParams(params.countryCode)
1520
const t = await getI18n()
1621
metadata.title = t("page.orders.title")
1722
metadata.description = t("page.orders.desc")

src/app/[countryCode]/(main)/account/@dashboard/page.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Metadata } from "next"
22

3-
import { getI18n } from "../../../../../locales/server"
3+
import { getI18n, setStaticParams } from "../../../../../locales/server"
44

55
import { getCustomer, listCustomerOrders } from "@lib/data"
66
import Overview from "@modules/account/components/overview"
@@ -11,7 +11,12 @@ export const metadata: Metadata = {
1111
description: "page.account.desc",
1212
}
1313

14-
export default async function OverviewTemplate() {
14+
type Props = {
15+
params: { countryCode: string; }
16+
}
17+
18+
export default async function OverviewTemplate({ params }: Props) {
19+
setStaticParams(params.countryCode)
1520
const t = await getI18n()
1621
metadata.title = t("page.account.title")
1722
metadata.description = t("page.account.desc")

src/app/[countryCode]/(main)/account/@dashboard/profile/page.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Metadata } from "next"
22

3-
import { getI18n } from "../../../../../../locales/server"
3+
import { getI18n, setStaticParams } from "../../../../../../locales/server"
44

55
import ProfilePhone from "@modules/account//components/profile-phone"
66
import ProfileBillingAddress from "@modules/account/components/profile-billing-address"
@@ -16,7 +16,12 @@ export const metadata: Metadata = {
1616
description: "page.profile.desc",
1717
}
1818

19-
export default async function Profile() {
19+
type Props = {
20+
params: { countryCode: string; }
21+
}
22+
23+
export default async function Profile({ params }: Props) {
24+
setStaticParams(params.countryCode)
2025
const t = await getI18n()
2126
metadata.title = t("page.profile.title")
2227
metadata.description = t("page.profile.desc")

src/app/[countryCode]/(main)/account/layout.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
import { getCustomer } from "@lib/data"
22
import AccountLayout from "@modules/account/templates/account-layout"
33

4+
import { getCurrentLocale, getStaticParams, setStaticParams } from "../../../../locales/server"
5+
46
export default async function AccountPageLayout({
57
dashboard,
68
login,
79
}: {
810
dashboard?: React.ReactNode
911
login?: React.ReactNode
1012
}) {
13+
setStaticParams(getCurrentLocale())
14+
1115
const customer = await getCustomer().catch(() => null)
1216

1317
return (

src/app/[countryCode]/(main)/cart/not-found.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Metadata } from "next"
22

3-
import { getI18n } from "../../../../locales/server"
3+
import { getI18n, getCurrentLocale, getStaticParams, setStaticParams } from "../../../../locales/server"
44

55
import InteractiveLink from "@modules/common/components/interactive-link"
66

@@ -10,6 +10,7 @@ export const metadata: Metadata = {
1010
}
1111

1212
export default async function NotFound() {
13+
setStaticParams(getCurrentLocale())
1314
const t = await getI18n()
1415

1516
metadata.description = t("generic.somethingwrong")

0 commit comments

Comments
 (0)