From 3bbf3aaf065e7a2c777588fa166398d78af10247 Mon Sep 17 00:00:00 2001 From: Giovanni-Schroevers Date: Thu, 2 Jul 2026 12:14:38 +0200 Subject: [PATCH 1/2] fix: evaluate breadcrumb "up" link title before awaits in getStaticProps Bug: The `up` (back/breadcrumb) link title is a Lingui `t` macro string, but it was constructed inline in the returned `props` object, after `await`ing the layout/page/config GraphQL queries. Lingui translates against a single global active-locale i18n instance, so a concurrent static-generation request for a different locale could call `i18n.activate()` during those awaits and cause the `t\`...\`` title to be rendered in the wrong language for the page being generated. Fix: Compute the `up` object (and its `t\`...\`` title) synchronously at the top of every affected `getStaticProps`, before any `await` yields control, so the translation is captured with the correct locale for the current request. Applied uniformly across the magento-graphcms, magento-open-source, and magento-storyblok example pages and the demo-magento-graphcommerce copy pages. Co-Authored-By: Claude Opus 4.8 --- examples/magento-graphcms/pages/404.tsx | 3 ++- examples/magento-graphcms/pages/[...url].tsx | 3 ++- examples/magento-graphcms/pages/account/addresses/add.tsx | 3 ++- examples/magento-graphcms/pages/account/addresses/edit.tsx | 3 ++- examples/magento-graphcms/pages/account/addresses/index.tsx | 3 ++- .../magento-graphcms/pages/account/authentication/index.tsx | 3 ++- examples/magento-graphcms/pages/account/contact/index.tsx | 3 ++- examples/magento-graphcms/pages/account/forgot-password.tsx | 3 ++- examples/magento-graphcms/pages/account/index.tsx | 3 ++- examples/magento-graphcms/pages/account/name/index.tsx | 3 ++- .../magento-graphcms/pages/account/orders/credit-memo.tsx | 3 ++- examples/magento-graphcms/pages/account/orders/index.tsx | 3 ++- examples/magento-graphcms/pages/account/orders/invoice.tsx | 3 ++- examples/magento-graphcms/pages/account/orders/shipment.tsx | 3 ++- examples/magento-graphcms/pages/account/orders/view.tsx | 3 ++- examples/magento-graphcms/pages/account/reviews/index.tsx | 3 ++- examples/magento-graphcms/pages/blog/[...url].tsx | 3 ++- examples/magento-graphcms/pages/blog/tagged/[url].tsx | 3 ++- .../pages/checkout/customer/addresses/edit.tsx | 3 ++- examples/magento-graphcms/pages/checkout/index.tsx | 3 ++- examples/magento-graphcms/pages/checkout/payment.tsx | 3 ++- examples/magento-graphcms/pages/checkout/success.tsx | 3 ++- .../pages/customer/account/createPassword/index.tsx | 3 ++- examples/magento-graphcms/pages/p/[url].tsx | 3 ++- examples/magento-graphcms/pages/search/[[...url]].tsx | 3 ++- examples/magento-graphcms/pages/service/[[...url]].tsx | 5 ++--- examples/magento-graphcms/pages/service/contact-us.tsx | 3 ++- examples/magento-graphcms/pages/service/newsletter.tsx | 3 ++- examples/magento-open-source/pages/404.tsx | 3 ++- examples/magento-open-source/pages/[...url].tsx | 3 ++- examples/magento-open-source/pages/account/addresses/add.tsx | 3 ++- .../magento-open-source/pages/account/addresses/edit.tsx | 3 ++- .../magento-open-source/pages/account/addresses/index.tsx | 3 ++- .../pages/account/authentication/index.tsx | 3 ++- examples/magento-open-source/pages/account/contact/index.tsx | 3 ++- .../magento-open-source/pages/account/forgot-password.tsx | 3 ++- examples/magento-open-source/pages/account/index.tsx | 3 ++- examples/magento-open-source/pages/account/name/index.tsx | 3 ++- .../magento-open-source/pages/account/orders/credit-memo.tsx | 3 ++- examples/magento-open-source/pages/account/orders/index.tsx | 3 ++- .../magento-open-source/pages/account/orders/invoice.tsx | 3 ++- .../magento-open-source/pages/account/orders/shipment.tsx | 3 ++- examples/magento-open-source/pages/account/orders/view.tsx | 3 ++- examples/magento-open-source/pages/account/reviews/index.tsx | 3 ++- .../pages/checkout/customer/addresses/edit.tsx | 3 ++- examples/magento-open-source/pages/checkout/index.tsx | 3 ++- examples/magento-open-source/pages/checkout/payment.tsx | 3 ++- examples/magento-open-source/pages/checkout/success.tsx | 3 ++- .../pages/customer/account/createPassword.tsx | 3 ++- examples/magento-open-source/pages/p/[url].tsx | 3 ++- examples/magento-open-source/pages/search/[[...url]].tsx | 3 ++- examples/magento-open-source/pages/service/contact-us.tsx | 3 ++- examples/magento-open-source/pages/service/newsletter.tsx | 3 ++- examples/magento-storyblok/pages/404.tsx | 3 ++- examples/magento-storyblok/pages/[...url].tsx | 3 ++- examples/magento-storyblok/pages/account/addresses/add.tsx | 3 ++- examples/magento-storyblok/pages/account/addresses/edit.tsx | 3 ++- examples/magento-storyblok/pages/account/addresses/index.tsx | 3 ++- .../magento-storyblok/pages/account/authentication/index.tsx | 3 ++- examples/magento-storyblok/pages/account/contact/index.tsx | 3 ++- examples/magento-storyblok/pages/account/forgot-password.tsx | 3 ++- examples/magento-storyblok/pages/account/index.tsx | 3 ++- examples/magento-storyblok/pages/account/name/index.tsx | 3 ++- .../magento-storyblok/pages/account/orders/credit-memo.tsx | 3 ++- examples/magento-storyblok/pages/account/orders/index.tsx | 3 ++- examples/magento-storyblok/pages/account/orders/invoice.tsx | 3 ++- examples/magento-storyblok/pages/account/orders/shipment.tsx | 3 ++- examples/magento-storyblok/pages/account/orders/view.tsx | 3 ++- examples/magento-storyblok/pages/account/reviews/index.tsx | 3 ++- examples/magento-storyblok/pages/blog/[...url].tsx | 3 ++- examples/magento-storyblok/pages/blog/tagged/[url].tsx | 3 ++- .../pages/checkout/customer/addresses/edit.tsx | 3 ++- examples/magento-storyblok/pages/checkout/index.tsx | 3 ++- examples/magento-storyblok/pages/checkout/payment.tsx | 3 ++- examples/magento-storyblok/pages/checkout/success.tsx | 3 ++- .../pages/customer/account/createPassword.tsx | 3 ++- examples/magento-storyblok/pages/p/[url].tsx | 3 ++- examples/magento-storyblok/pages/search/[[...url]].tsx | 3 ++- examples/magento-storyblok/pages/service/[[...url]].tsx | 3 ++- examples/magento-storyblok/pages/service/contact-us.tsx | 3 ++- examples/magento-storyblok/pages/service/newsletter.tsx | 3 ++- .../copy/pages/test/[[...url]].tsx | 3 ++- .../demo-magento-graphcommerce/copy/pages/test/slider.tsx | 3 ++- .../copy/pages/test/typography.tsx | 3 ++- 84 files changed, 168 insertions(+), 86 deletions(-) diff --git a/examples/magento-graphcms/pages/404.tsx b/examples/magento-graphcms/pages/404.tsx index 40de528c783..28778f879ea 100644 --- a/examples/magento-graphcms/pages/404.tsx +++ b/examples/magento-graphcms/pages/404.tsx @@ -75,6 +75,7 @@ export default RouteNotFoundPage export const getStaticProps: GetPageStaticProps = async (context) => { const client = graphqlSharedClient(context) + const up = { href: '/', title: t`Home` } const staticClient = graphqlSsrClient(context) const conf = client.query({ query: StoreConfigDocument }) const layout = staticClient.query({ @@ -85,7 +86,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { return { props: { ...(await layout).data, - up: { href: '/', title: t`Home` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, revalidate: revalidate(), diff --git a/examples/magento-graphcms/pages/[...url].tsx b/examples/magento-graphcms/pages/[...url].tsx index aaf3599dda7..955156d3f87 100644 --- a/examples/magento-graphcms/pages/[...url].tsx +++ b/examples/magento-graphcms/pages/[...url].tsx @@ -191,6 +191,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (!url || !query) return { notFound: true, revalidate: revalidate() } const client = graphqlSharedClient(context) + const homeUp = { href: '/', title: t`Home` } const conf = client.query({ query: StoreConfigDocument }) const filterTypes = getFilterTypes(client) @@ -259,7 +260,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { const up = category_url_path && category_name ? { href: `/${category_url_path}`, title: category_name } - : { href: '/', title: t`Home` } + : homeUp await waitForSiblings const result = { diff --git a/examples/magento-graphcms/pages/account/addresses/add.tsx b/examples/magento-graphcms/pages/account/addresses/add.tsx index 5d48af50acd..03c8a4db82d 100644 --- a/examples/magento-graphcms/pages/account/addresses/add.tsx +++ b/examples/magento-graphcms/pages/account/addresses/add.tsx @@ -64,13 +64,14 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account', title: t`Account` } const conf = client.query({ query: StoreConfigDocument }) return { props: { apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account', title: t`Account` }, + up, }, } } diff --git a/examples/magento-graphcms/pages/account/addresses/edit.tsx b/examples/magento-graphcms/pages/account/addresses/edit.tsx index 4e67e01ca14..7f2fc6ed1e2 100644 --- a/examples/magento-graphcms/pages/account/addresses/edit.tsx +++ b/examples/magento-graphcms/pages/account/addresses/edit.tsx @@ -79,13 +79,14 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account/addresses', title: t`Addresses` } const conf = client.query({ query: StoreConfigDocument }) return { props: { apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account/addresses', title: t`Addresses` }, + up, }, } } diff --git a/examples/magento-graphcms/pages/account/addresses/index.tsx b/examples/magento-graphcms/pages/account/addresses/index.tsx index b8c8729acbf..0920c59355c 100644 --- a/examples/magento-graphcms/pages/account/addresses/index.tsx +++ b/examples/magento-graphcms/pages/account/addresses/index.tsx @@ -64,6 +64,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account', title: t`Account` } const staticClient = graphqlSsrClient(context) const conf = client.query({ query: StoreConfigDocument }) @@ -76,7 +77,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { ...(await countryRegions).data, apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account', title: t`Account` }, + up, }, } } diff --git a/examples/magento-graphcms/pages/account/authentication/index.tsx b/examples/magento-graphcms/pages/account/authentication/index.tsx index 735ab15bddb..8ae9abe4ac0 100644 --- a/examples/magento-graphcms/pages/account/authentication/index.tsx +++ b/examples/magento-graphcms/pages/account/authentication/index.tsx @@ -68,13 +68,14 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account', title: t`Account` } const conf = client.query({ query: StoreConfigDocument }) return { props: { apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account', title: t`Account` }, + up, }, } } diff --git a/examples/magento-graphcms/pages/account/contact/index.tsx b/examples/magento-graphcms/pages/account/contact/index.tsx index 61bdbac7f37..b4b1b36973b 100644 --- a/examples/magento-graphcms/pages/account/contact/index.tsx +++ b/examples/magento-graphcms/pages/account/contact/index.tsx @@ -64,13 +64,14 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account', title: t`Account` } const conf = client.query({ query: StoreConfigDocument }) return { props: { apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account', title: t`Account` }, + up, }, } } diff --git a/examples/magento-graphcms/pages/account/forgot-password.tsx b/examples/magento-graphcms/pages/account/forgot-password.tsx index e3d4bb6eb7a..d307822a741 100644 --- a/examples/magento-graphcms/pages/account/forgot-password.tsx +++ b/examples/magento-graphcms/pages/account/forgot-password.tsx @@ -48,13 +48,14 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account/signin', title: t`Sign in` } const conf = client.query({ query: StoreConfigDocument }) return { props: { apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account/signin', title: t`Sign in` }, + up, }, } } diff --git a/examples/magento-graphcms/pages/account/index.tsx b/examples/magento-graphcms/pages/account/index.tsx index 8e0c47d5cbf..af44cfe25c1 100644 --- a/examples/magento-graphcms/pages/account/index.tsx +++ b/examples/magento-graphcms/pages/account/index.tsx @@ -155,6 +155,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { const staticClient = graphqlSsrClient(context) const client = graphqlSharedClient(context) + const up = { href: '/', title: t`Home` } const conf = client.query({ query: StoreConfigDocument }) const layout = staticClient.query({ query: LayoutDocument, @@ -164,7 +165,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { return { props: { ...(await layout).data, - up: { href: '/', title: t`Home` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, revalidate: revalidate(), diff --git a/examples/magento-graphcms/pages/account/name/index.tsx b/examples/magento-graphcms/pages/account/name/index.tsx index 67d556e5570..fc1fbba7942 100644 --- a/examples/magento-graphcms/pages/account/name/index.tsx +++ b/examples/magento-graphcms/pages/account/name/index.tsx @@ -77,6 +77,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account', title: t`Account` } const conf = client.query({ query: StoreConfigDocument }) if (magentoVersion >= 247) await preloadAttributesForm(client, 'customer_account_edit') @@ -85,7 +86,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { props: { apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account', title: t`Account` }, + up, }, } } diff --git a/examples/magento-graphcms/pages/account/orders/credit-memo.tsx b/examples/magento-graphcms/pages/account/orders/credit-memo.tsx index fc5165f2bb7..987492ae6c2 100644 --- a/examples/magento-graphcms/pages/account/orders/credit-memo.tsx +++ b/examples/magento-graphcms/pages/account/orders/credit-memo.tsx @@ -99,6 +99,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account/orders', title: t`Orders` } const staticClient = graphqlSsrClient(context) const config = client.query({ query: StoreConfigDocument }) @@ -111,7 +112,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { ...(await countryRegions).data, apolloState: await config.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account/orders', title: t`Orders` }, + up, }, } } diff --git a/examples/magento-graphcms/pages/account/orders/index.tsx b/examples/magento-graphcms/pages/account/orders/index.tsx index 069dd3e64e7..1522230cd06 100644 --- a/examples/magento-graphcms/pages/account/orders/index.tsx +++ b/examples/magento-graphcms/pages/account/orders/index.tsx @@ -85,13 +85,14 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account', title: t`Account` } const conf = client.query({ query: StoreConfigDocument }) return { props: { apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account', title: t`Account` }, + up, }, } } diff --git a/examples/magento-graphcms/pages/account/orders/invoice.tsx b/examples/magento-graphcms/pages/account/orders/invoice.tsx index 07812af6794..be64f5e9b2b 100644 --- a/examples/magento-graphcms/pages/account/orders/invoice.tsx +++ b/examples/magento-graphcms/pages/account/orders/invoice.tsx @@ -96,6 +96,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account/orders', title: t`Orders` } const staticClient = graphqlSsrClient(context) const config = client.query({ query: StoreConfigDocument }) @@ -108,7 +109,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { ...(await countryRegions).data, apolloState: await config.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account/orders', title: t`Orders` }, + up, }, } } diff --git a/examples/magento-graphcms/pages/account/orders/shipment.tsx b/examples/magento-graphcms/pages/account/orders/shipment.tsx index 36006bca0b1..a9903ac906d 100644 --- a/examples/magento-graphcms/pages/account/orders/shipment.tsx +++ b/examples/magento-graphcms/pages/account/orders/shipment.tsx @@ -96,6 +96,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account/orders', title: t`Orders` } const staticClient = graphqlSsrClient(context) const config = client.query({ query: StoreConfigDocument }) @@ -108,7 +109,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { ...(await countryRegions).data, apolloState: await config.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account/orders', title: t`Orders` }, + up, }, } } diff --git a/examples/magento-graphcms/pages/account/orders/view.tsx b/examples/magento-graphcms/pages/account/orders/view.tsx index 07396f916c4..4c45f920d20 100644 --- a/examples/magento-graphcms/pages/account/orders/view.tsx +++ b/examples/magento-graphcms/pages/account/orders/view.tsx @@ -95,6 +95,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account/orders', title: t`Orders` } const staticClient = graphqlSsrClient(context) const config = client.query({ query: StoreConfigDocument }) @@ -107,7 +108,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { ...(await countryRegions).data, apolloState: await config.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account/orders', title: t`Orders` }, + up, }, } } diff --git a/examples/magento-graphcms/pages/account/reviews/index.tsx b/examples/magento-graphcms/pages/account/reviews/index.tsx index c396b67a25c..e8fc754daf4 100644 --- a/examples/magento-graphcms/pages/account/reviews/index.tsx +++ b/examples/magento-graphcms/pages/account/reviews/index.tsx @@ -78,12 +78,13 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account', title: t`Account` } const conf = client.query({ query: StoreConfigDocument }) return { props: { apolloState: await conf.then(() => client.cache.extract()), - up: { href: '/account', title: t`Account` }, + up, }, } } diff --git a/examples/magento-graphcms/pages/blog/[...url].tsx b/examples/magento-graphcms/pages/blog/[...url].tsx index ba6a3533308..527c616d76e 100644 --- a/examples/magento-graphcms/pages/blog/[...url].tsx +++ b/examples/magento-graphcms/pages/blog/[...url].tsx @@ -105,6 +105,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { const urlKey = params?.url.join('/') ?? '' const client = graphqlSharedClient(context) + const up = { href: '/blog', title: t`Blog` } const staticClient = graphqlSsrClient(context) const limit = 4 const conf = client.query({ query: StoreConfigDocument }) @@ -131,7 +132,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { ...pageData, ...blogPostsData, ...(await layout).data, - up: { href: '/blog', title: t`Blog` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, revalidate: revalidate(), diff --git a/examples/magento-graphcms/pages/blog/tagged/[url].tsx b/examples/magento-graphcms/pages/blog/tagged/[url].tsx index de18b9ccaaf..5a4434bc623 100644 --- a/examples/magento-graphcms/pages/blog/tagged/[url].tsx +++ b/examples/magento-graphcms/pages/blog/tagged/[url].tsx @@ -82,6 +82,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { const { locale, params } = context const urlKey = params?.url ?? '??' const client = graphqlSharedClient(context) + const up = { href: '/blog', title: t`Blog` } const staticClient = graphqlSsrClient(context) const limit = 99 const conf = client.query({ query: StoreConfigDocument }) @@ -106,7 +107,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { ...pageData.data, ...posts.data, ...(await layout).data, - up: { href: '/blog', title: t`Blog` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, revalidate: revalidate(), diff --git a/examples/magento-graphcms/pages/checkout/customer/addresses/edit.tsx b/examples/magento-graphcms/pages/checkout/customer/addresses/edit.tsx index f9889fb147b..ae2f2685d61 100644 --- a/examples/magento-graphcms/pages/checkout/customer/addresses/edit.tsx +++ b/examples/magento-graphcms/pages/checkout/customer/addresses/edit.tsx @@ -95,13 +95,14 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCartDisabled(context.locale) || getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/checkout', title: t`Shipping` } const conf = client.query({ query: StoreConfigDocument }) return { props: { apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/checkout', title: t`Shipping` }, + up, }, } } diff --git a/examples/magento-graphcms/pages/checkout/index.tsx b/examples/magento-graphcms/pages/checkout/index.tsx index 10995e25e47..b8fcc5169c8 100644 --- a/examples/magento-graphcms/pages/checkout/index.tsx +++ b/examples/magento-graphcms/pages/checkout/index.tsx @@ -154,6 +154,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCheckoutIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/cart', title: t`Cart` } const conf = client.query({ query: StoreConfigDocument }) const staticClient = graphqlSsrClient(context) @@ -165,7 +166,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { return { props: { ...(await layout).data, - up: { href: '/cart', title: t`Cart` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, } diff --git a/examples/magento-graphcms/pages/checkout/payment.tsx b/examples/magento-graphcms/pages/checkout/payment.tsx index 3fd9dfb559a..ca1347d3c62 100644 --- a/examples/magento-graphcms/pages/checkout/payment.tsx +++ b/examples/magento-graphcms/pages/checkout/payment.tsx @@ -158,6 +158,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCheckoutIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/checkout', title: t`Shipping` } const staticClient = graphqlSsrClient(context) const conf = client.query({ query: StoreConfigDocument }) @@ -169,7 +170,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { return { props: { ...(await layout).data, - up: { href: '/checkout', title: t`Shipping` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, } diff --git a/examples/magento-graphcms/pages/checkout/success.tsx b/examples/magento-graphcms/pages/checkout/success.tsx index b2681712566..bf47e65872f 100644 --- a/examples/magento-graphcms/pages/checkout/success.tsx +++ b/examples/magento-graphcms/pages/checkout/success.tsx @@ -103,6 +103,7 @@ export default OrderSuccessPage export const getStaticProps: GetPageStaticProps = async (context) => { if (getCheckoutIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/', title: t`Home` } const staticClient = graphqlSsrClient(context) const conf = client.query({ query: StoreConfigDocument }) const layout = staticClient.query({ @@ -112,7 +113,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { return { props: { ...(await layout).data, - up: { href: '/', title: t`Home` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, } diff --git a/examples/magento-graphcms/pages/customer/account/createPassword/index.tsx b/examples/magento-graphcms/pages/customer/account/createPassword/index.tsx index d723689e3d8..3674c463571 100644 --- a/examples/magento-graphcms/pages/customer/account/createPassword/index.tsx +++ b/examples/magento-graphcms/pages/customer/account/createPassword/index.tsx @@ -85,13 +85,14 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account/signin', title: t`Sign in` } const conf = client.query({ query: StoreConfigDocument }) return { props: { apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account/signin', title: t`Sign in` }, + up, }, } } diff --git a/examples/magento-graphcms/pages/p/[url].tsx b/examples/magento-graphcms/pages/p/[url].tsx index a917caaf9c4..8b61396982c 100644 --- a/examples/magento-graphcms/pages/p/[url].tsx +++ b/examples/magento-graphcms/pages/p/[url].tsx @@ -200,6 +200,7 @@ export const getStaticPaths: GetPageStaticPaths = async ({ locales = [] }) => { export const getStaticProps: GetPageStaticProps = async (context) => { const { locale, params } = context const client = graphqlSharedClient(context) + const homeUp = { href: '/', title: t`Home` } const staticClient = graphqlSsrClient(context) const urlKey = params?.url ?? '??' @@ -226,7 +227,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { const up = category?.url_path && category?.name ? { href: `/${category.url_path}`, title: category.name } - : { href: '/', title: t`Home` } + : homeUp const usps = staticClient.query({ query: UspsDocument, fetchPolicy: cacheFirst(staticClient) }) const result = { diff --git a/examples/magento-graphcms/pages/search/[[...url]].tsx b/examples/magento-graphcms/pages/search/[[...url]].tsx index 9f871450b7c..d1c66984587 100644 --- a/examples/magento-graphcms/pages/search/[[...url]].tsx +++ b/examples/magento-graphcms/pages/search/[[...url]].tsx @@ -86,6 +86,7 @@ export const getServerSideProps: GetPageStaticProps = async (context) => { const search = searchShort.length >= 3 ? searchShort : '' const client = graphqlSharedClient(context) + const up = { href: '/', title: t`Home` } const conf = client.query({ query: StoreConfigDocument }) const filterTypes = getFilterTypes(client, true) @@ -125,7 +126,7 @@ export const getServerSideProps: GetPageStaticProps = async (context) => { ...(await layout)?.data, filterTypes: await filterTypes, params: productListParams, - up: { href: '/', title: t`Home` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, } diff --git a/examples/magento-graphcms/pages/service/[[...url]].tsx b/examples/magento-graphcms/pages/service/[[...url]].tsx index ba21524ba05..a9706046746 100644 --- a/examples/magento-graphcms/pages/service/[[...url]].tsx +++ b/examples/magento-graphcms/pages/service/[[...url]].tsx @@ -90,6 +90,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { const { locale, params } = context const url = params?.url ? `service/${params?.url.join('/')}` : 'service' const client = graphqlSharedClient(context) + const up = url === 'service' ? null : { href: '/service', title: t`Customer Service` } const staticClient = graphqlSsrClient(context) const conf = client.query({ query: StoreConfigDocument }) const page = hygraphPageContent(staticClient, url) @@ -100,13 +101,11 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (!(await page).data.pages?.[0]) return redirectOrNotFound(staticClient, conf, { url }, locale) - const isRoot = url === 'service' - return { props: { ...(await page).data, ...(await layout).data, - up: isRoot ? null : { href: '/service', title: t`Customer Service` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, revalidate: revalidate(), diff --git a/examples/magento-graphcms/pages/service/contact-us.tsx b/examples/magento-graphcms/pages/service/contact-us.tsx index 582b909b97c..17444fa2a7e 100644 --- a/examples/magento-graphcms/pages/service/contact-us.tsx +++ b/examples/magento-graphcms/pages/service/contact-us.tsx @@ -64,6 +64,7 @@ export default ContactUs export const getStaticProps: GetPageStaticProps = async (context) => { const url = 'service/contact-us' const client = graphqlSharedClient(context) + const up = { href: '/service', title: t`Customer Service` } const staticClient = graphqlSsrClient(context) const conf = client.query({ query: StoreConfigDocument }) const page = hygraphPageContent(staticClient, url) @@ -79,7 +80,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { props: { ...(await page).data, ...(await layout).data, - up: { href: '/service', title: t`Customer Service` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, revalidate: revalidate(), diff --git a/examples/magento-graphcms/pages/service/newsletter.tsx b/examples/magento-graphcms/pages/service/newsletter.tsx index 658cffd0486..22903fa5f99 100644 --- a/examples/magento-graphcms/pages/service/newsletter.tsx +++ b/examples/magento-graphcms/pages/service/newsletter.tsx @@ -68,6 +68,7 @@ export default NewsletterSubscribe export const getStaticProps: GetPageStaticProps = async (context) => { const url = 'service/newsletter' const client = graphqlSharedClient(context) + const up = { href: '/service', title: t`Customer Service` } const staticClient = graphqlSsrClient(context) const conf = client.query({ query: StoreConfigDocument }) const page = hygraphPageContent(staticClient, url) @@ -82,7 +83,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { props: { ...(await page).data, ...(await layout).data, - up: { href: '/service', title: t`Customer Service` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, revalidate: revalidate(), diff --git a/examples/magento-open-source/pages/404.tsx b/examples/magento-open-source/pages/404.tsx index 2879fc63584..f92b6588332 100644 --- a/examples/magento-open-source/pages/404.tsx +++ b/examples/magento-open-source/pages/404.tsx @@ -55,6 +55,7 @@ export default RouteNotFoundPage export const getStaticProps: GetPageStaticProps = async (context) => { const client = graphqlSharedClient(context) + const up = { href: '/', title: t`Home` } const staticClient = graphqlSsrClient(context) const conf = client.query({ query: StoreConfigDocument }) const layout = staticClient.query({ @@ -70,7 +71,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { props: { ...(await layout).data, cmsPage: cmsPage ?? null, - up: { href: '/', title: t`Home` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, revalidate: revalidate(), diff --git a/examples/magento-open-source/pages/[...url].tsx b/examples/magento-open-source/pages/[...url].tsx index 5b1bb8cdb8f..052187dee3e 100644 --- a/examples/magento-open-source/pages/[...url].tsx +++ b/examples/magento-open-source/pages/[...url].tsx @@ -155,6 +155,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (!url || !query) return { notFound: true } const client = graphqlSharedClient(context) + const homeUp = { href: '/', title: t`Home` } const conf = client.query({ query: StoreConfigDocument }) const filterTypes = getFilterTypes(client) @@ -221,7 +222,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { const up = category_url_path && category_name ? { href: `/${category_url_path}`, title: category_name } - : { href: '/', title: t`Home` } + : homeUp await waitForSiblings const result = { diff --git a/examples/magento-open-source/pages/account/addresses/add.tsx b/examples/magento-open-source/pages/account/addresses/add.tsx index cfbe153189e..82d0e8d6b82 100644 --- a/examples/magento-open-source/pages/account/addresses/add.tsx +++ b/examples/magento-open-source/pages/account/addresses/add.tsx @@ -65,13 +65,14 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account', title: t`Account` } const conf = client.query({ query: StoreConfigDocument }) return { props: { apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account', title: t`Account` }, + up, }, } } diff --git a/examples/magento-open-source/pages/account/addresses/edit.tsx b/examples/magento-open-source/pages/account/addresses/edit.tsx index 12cc48cc45b..24fc985781d 100644 --- a/examples/magento-open-source/pages/account/addresses/edit.tsx +++ b/examples/magento-open-source/pages/account/addresses/edit.tsx @@ -80,13 +80,14 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account/addresses', title: t`Addresses` } const conf = client.query({ query: StoreConfigDocument }) return { props: { apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account/addresses', title: t`Addresses` }, + up, }, } } diff --git a/examples/magento-open-source/pages/account/addresses/index.tsx b/examples/magento-open-source/pages/account/addresses/index.tsx index 88926d82ba1..2f3b3b06999 100644 --- a/examples/magento-open-source/pages/account/addresses/index.tsx +++ b/examples/magento-open-source/pages/account/addresses/index.tsx @@ -61,6 +61,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account', title: t`Account` } const staticClient = graphqlSsrClient(context) const conf = client.query({ query: StoreConfigDocument }) @@ -73,7 +74,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { ...(await countryRegions).data, apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account', title: t`Account` }, + up, }, } } diff --git a/examples/magento-open-source/pages/account/authentication/index.tsx b/examples/magento-open-source/pages/account/authentication/index.tsx index f1f79c34200..b3d78f3fd4c 100644 --- a/examples/magento-open-source/pages/account/authentication/index.tsx +++ b/examples/magento-open-source/pages/account/authentication/index.tsx @@ -69,13 +69,14 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account', title: t`Account` } const conf = client.query({ query: StoreConfigDocument }) return { props: { apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account', title: t`Account` }, + up, }, } } diff --git a/examples/magento-open-source/pages/account/contact/index.tsx b/examples/magento-open-source/pages/account/contact/index.tsx index 0cb87797105..97dc388c288 100644 --- a/examples/magento-open-source/pages/account/contact/index.tsx +++ b/examples/magento-open-source/pages/account/contact/index.tsx @@ -65,13 +65,14 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account', title: t`Account` } const conf = client.query({ query: StoreConfigDocument }) return { props: { apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account', title: t`Account` }, + up, }, } } diff --git a/examples/magento-open-source/pages/account/forgot-password.tsx b/examples/magento-open-source/pages/account/forgot-password.tsx index 92eaa1ca7d5..4a3c623ae5f 100644 --- a/examples/magento-open-source/pages/account/forgot-password.tsx +++ b/examples/magento-open-source/pages/account/forgot-password.tsx @@ -50,13 +50,14 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account/signin', title: t`Sign in` } const conf = client.query({ query: StoreConfigDocument }) return { props: { apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account/signin', title: t`Sign in` }, + up, }, } } diff --git a/examples/magento-open-source/pages/account/index.tsx b/examples/magento-open-source/pages/account/index.tsx index d047d00457c..af90e713b99 100644 --- a/examples/magento-open-source/pages/account/index.tsx +++ b/examples/magento-open-source/pages/account/index.tsx @@ -156,6 +156,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { const staticClient = graphqlSsrClient(context) const client = graphqlSharedClient(context) + const up = { href: '/', title: t`Home` } const conf = client.query({ query: StoreConfigDocument }) const layout = staticClient.query({ query: LayoutDocument, @@ -165,7 +166,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { return { props: { ...(await layout).data, - up: { href: '/', title: t`Home` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, revalidate: revalidate(), diff --git a/examples/magento-open-source/pages/account/name/index.tsx b/examples/magento-open-source/pages/account/name/index.tsx index 5b6d67c5bfa..94c8527b7a9 100644 --- a/examples/magento-open-source/pages/account/name/index.tsx +++ b/examples/magento-open-source/pages/account/name/index.tsx @@ -73,6 +73,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account', title: t`Account` } const conf = client.query({ query: StoreConfigDocument }) if (magentoVersion >= 247) await preloadAttributesForm(client, 'customer_account_edit') @@ -81,7 +82,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { props: { apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account', title: t`Account` }, + up, }, } } diff --git a/examples/magento-open-source/pages/account/orders/credit-memo.tsx b/examples/magento-open-source/pages/account/orders/credit-memo.tsx index fc5165f2bb7..987492ae6c2 100644 --- a/examples/magento-open-source/pages/account/orders/credit-memo.tsx +++ b/examples/magento-open-source/pages/account/orders/credit-memo.tsx @@ -99,6 +99,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account/orders', title: t`Orders` } const staticClient = graphqlSsrClient(context) const config = client.query({ query: StoreConfigDocument }) @@ -111,7 +112,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { ...(await countryRegions).data, apolloState: await config.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account/orders', title: t`Orders` }, + up, }, } } diff --git a/examples/magento-open-source/pages/account/orders/index.tsx b/examples/magento-open-source/pages/account/orders/index.tsx index 3f54425ea57..4540c468567 100644 --- a/examples/magento-open-source/pages/account/orders/index.tsx +++ b/examples/magento-open-source/pages/account/orders/index.tsx @@ -86,13 +86,14 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account', title: t`Account` } const conf = client.query({ query: StoreConfigDocument }) return { props: { apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account', title: t`Account` }, + up, }, } } diff --git a/examples/magento-open-source/pages/account/orders/invoice.tsx b/examples/magento-open-source/pages/account/orders/invoice.tsx index 07812af6794..be64f5e9b2b 100644 --- a/examples/magento-open-source/pages/account/orders/invoice.tsx +++ b/examples/magento-open-source/pages/account/orders/invoice.tsx @@ -96,6 +96,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account/orders', title: t`Orders` } const staticClient = graphqlSsrClient(context) const config = client.query({ query: StoreConfigDocument }) @@ -108,7 +109,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { ...(await countryRegions).data, apolloState: await config.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account/orders', title: t`Orders` }, + up, }, } } diff --git a/examples/magento-open-source/pages/account/orders/shipment.tsx b/examples/magento-open-source/pages/account/orders/shipment.tsx index 36006bca0b1..a9903ac906d 100644 --- a/examples/magento-open-source/pages/account/orders/shipment.tsx +++ b/examples/magento-open-source/pages/account/orders/shipment.tsx @@ -96,6 +96,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account/orders', title: t`Orders` } const staticClient = graphqlSsrClient(context) const config = client.query({ query: StoreConfigDocument }) @@ -108,7 +109,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { ...(await countryRegions).data, apolloState: await config.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account/orders', title: t`Orders` }, + up, }, } } diff --git a/examples/magento-open-source/pages/account/orders/view.tsx b/examples/magento-open-source/pages/account/orders/view.tsx index 7d7560f88d3..e2900d0a120 100644 --- a/examples/magento-open-source/pages/account/orders/view.tsx +++ b/examples/magento-open-source/pages/account/orders/view.tsx @@ -96,6 +96,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account/orders', title: t`Orders` } const staticClient = graphqlSsrClient(context) const config = client.query({ query: StoreConfigDocument }) @@ -108,7 +109,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { ...(await countryRegions).data, apolloState: await config.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account/orders', title: t`Orders` }, + up, }, } } diff --git a/examples/magento-open-source/pages/account/reviews/index.tsx b/examples/magento-open-source/pages/account/reviews/index.tsx index 3d1215423ea..0cf2594fc7f 100644 --- a/examples/magento-open-source/pages/account/reviews/index.tsx +++ b/examples/magento-open-source/pages/account/reviews/index.tsx @@ -79,12 +79,13 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account', title: t`Account` } const conf = client.query({ query: StoreConfigDocument }) return { props: { apolloState: await conf.then(() => client.cache.extract()), - up: { href: '/account', title: t`Account` }, + up, }, } } diff --git a/examples/magento-open-source/pages/checkout/customer/addresses/edit.tsx b/examples/magento-open-source/pages/checkout/customer/addresses/edit.tsx index 18a63b6d1b6..b5fd0e8e79f 100644 --- a/examples/magento-open-source/pages/checkout/customer/addresses/edit.tsx +++ b/examples/magento-open-source/pages/checkout/customer/addresses/edit.tsx @@ -96,13 +96,14 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCartDisabled(context.locale) || getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/checkout', title: t`Shipping` } const conf = client.query({ query: StoreConfigDocument }) return { props: { apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/checkout', title: t`Shipping` }, + up, }, } } diff --git a/examples/magento-open-source/pages/checkout/index.tsx b/examples/magento-open-source/pages/checkout/index.tsx index ed927f81d0f..b224f7bde5d 100644 --- a/examples/magento-open-source/pages/checkout/index.tsx +++ b/examples/magento-open-source/pages/checkout/index.tsx @@ -155,6 +155,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCheckoutIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/cart', title: t`Cart` } const conf = client.query({ query: StoreConfigDocument }) const staticClient = graphqlSsrClient(context) @@ -166,7 +167,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { return { props: { ...(await layout).data, - up: { href: '/cart', title: t`Cart` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, } diff --git a/examples/magento-open-source/pages/checkout/payment.tsx b/examples/magento-open-source/pages/checkout/payment.tsx index 90ab9a5c1b5..633845c1def 100644 --- a/examples/magento-open-source/pages/checkout/payment.tsx +++ b/examples/magento-open-source/pages/checkout/payment.tsx @@ -158,6 +158,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCheckoutIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/checkout', title: t`Shipping` } const staticClient = graphqlSsrClient(context) const conf = client.query({ query: StoreConfigDocument }) @@ -169,7 +170,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { return { props: { ...(await layout).data, - up: { href: '/checkout', title: t`Shipping` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, } diff --git a/examples/magento-open-source/pages/checkout/success.tsx b/examples/magento-open-source/pages/checkout/success.tsx index b9c5f37fac6..bef02f59c36 100644 --- a/examples/magento-open-source/pages/checkout/success.tsx +++ b/examples/magento-open-source/pages/checkout/success.tsx @@ -99,6 +99,7 @@ export default OrderSuccessPage export const getStaticProps: GetPageStaticProps = async (context) => { if (getCheckoutIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/', title: t`Home` } const staticClient = graphqlSsrClient(context) const conf = client.query({ query: StoreConfigDocument }) const layout = staticClient.query({ @@ -108,7 +109,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { return { props: { ...(await layout).data, - up: { href: '/', title: t`Home` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, } diff --git a/examples/magento-open-source/pages/customer/account/createPassword.tsx b/examples/magento-open-source/pages/customer/account/createPassword.tsx index 505f3a28827..9ba2529f1d4 100644 --- a/examples/magento-open-source/pages/customer/account/createPassword.tsx +++ b/examples/magento-open-source/pages/customer/account/createPassword.tsx @@ -83,13 +83,14 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account/signin', title: t`Sign in` } const conf = client.query({ query: StoreConfigDocument }) return { props: { apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account/signin', title: t`Sign in` }, + up, }, } } diff --git a/examples/magento-open-source/pages/p/[url].tsx b/examples/magento-open-source/pages/p/[url].tsx index c03a554814e..6e947118c0b 100644 --- a/examples/magento-open-source/pages/p/[url].tsx +++ b/examples/magento-open-source/pages/p/[url].tsx @@ -222,6 +222,7 @@ export const getStaticPaths: GetPageStaticPaths = async ({ locales = [] }) => { export const getStaticProps: GetPageStaticProps = async (context) => { const { locale, params } = context const client = graphqlSharedClient(context) + const homeUp = { href: '/', title: t`Home` } const staticClient = graphqlSsrClient(context) const urlKey = params?.url ?? '??' @@ -247,7 +248,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { const up = category?.url_path && category?.name ? { href: `/${category.url_path}`, title: category.name } - : { href: '/', title: t`Home` } + : homeUp const result = { props: { diff --git a/examples/magento-open-source/pages/search/[[...url]].tsx b/examples/magento-open-source/pages/search/[[...url]].tsx index f7bb9556ca9..0d9f9b63c3e 100644 --- a/examples/magento-open-source/pages/search/[[...url]].tsx +++ b/examples/magento-open-source/pages/search/[[...url]].tsx @@ -89,6 +89,7 @@ export const getServerSideProps: GetPageStaticProps = async (context) => { const search = searchShort.length >= 3 ? searchShort : '' const client = graphqlSharedClient(context) + const up = { href: '/', title: t`Home` } const conf = client.query({ query: StoreConfigDocument }) const filterTypes = getFilterTypes(client, true) @@ -137,7 +138,7 @@ export const getServerSideProps: GetPageStaticProps = async (context) => { ...(await layout)?.data, filterTypes: await filterTypes, params: productListParams, - up: { href: '/', title: t`Home` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, } diff --git a/examples/magento-open-source/pages/service/contact-us.tsx b/examples/magento-open-source/pages/service/contact-us.tsx index b490d324553..d5e35626216 100644 --- a/examples/magento-open-source/pages/service/contact-us.tsx +++ b/examples/magento-open-source/pages/service/contact-us.tsx @@ -50,6 +50,7 @@ export default ContactUs export const getStaticProps: GetPageStaticProps = async (context) => { const client = graphqlSharedClient(context) + const up = { href: '/service', title: t`Customer Service` } const staticClient = graphqlSsrClient(context) const conf = client.query({ query: StoreConfigDocument }) const layout = staticClient.query({ @@ -62,7 +63,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { return { props: { ...(await layout).data, - up: { href: '/service', title: t`Customer Service` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, revalidate: revalidate(), diff --git a/examples/magento-open-source/pages/service/newsletter.tsx b/examples/magento-open-source/pages/service/newsletter.tsx index d9022b72728..a69c8c6b0cf 100644 --- a/examples/magento-open-source/pages/service/newsletter.tsx +++ b/examples/magento-open-source/pages/service/newsletter.tsx @@ -52,6 +52,7 @@ export default NewsletterSubscribe export const getStaticProps: GetPageStaticProps = async (context) => { const client = graphqlSharedClient(context) + const up = { href: '/service', title: t`Customer Service` } const staticClient = graphqlSsrClient(context) const conf = client.query({ query: StoreConfigDocument }) const layout = staticClient.query({ @@ -62,7 +63,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { return { props: { ...(await layout).data, - up: { href: '/service', title: t`Customer Service` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, revalidate: revalidate(), diff --git a/examples/magento-storyblok/pages/404.tsx b/examples/magento-storyblok/pages/404.tsx index af531d63d5e..3c0f20efde3 100644 --- a/examples/magento-storyblok/pages/404.tsx +++ b/examples/magento-storyblok/pages/404.tsx @@ -49,6 +49,7 @@ export default RouteNotFoundPage export const getStaticProps: GetPageStaticProps = async (context) => { const client = graphqlSharedClient(context) + const up = { href: '/', title: t`Home` } const staticClient = graphqlSsrClient(context) const conf = client.query({ query: StoreConfigDocument }) const layout = staticClient.query({ @@ -61,7 +62,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { props: { ...(await layout).data, globalConfig: (await globalConfig)?.content ?? null, - up: { href: '/', title: t`Home` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, revalidate: revalidate(), diff --git a/examples/magento-storyblok/pages/[...url].tsx b/examples/magento-storyblok/pages/[...url].tsx index bd1b33ff99a..4e2b7057a3f 100644 --- a/examples/magento-storyblok/pages/[...url].tsx +++ b/examples/magento-storyblok/pages/[...url].tsx @@ -179,6 +179,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (!url || !query) return { notFound: true } const client = graphqlSharedClient(context) + const homeUp = { href: '/', title: t`Home` } const conf = client.query({ query: StoreConfigDocument }) const filterTypes = getFilterTypes(client) @@ -249,7 +250,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { const up = category_url_path && category_name ? { href: `/${category_url_path}`, title: category_name } - : { href: '/', title: t`Home` } + : homeUp await waitForSiblings const result = { diff --git a/examples/magento-storyblok/pages/account/addresses/add.tsx b/examples/magento-storyblok/pages/account/addresses/add.tsx index cfbe153189e..82d0e8d6b82 100644 --- a/examples/magento-storyblok/pages/account/addresses/add.tsx +++ b/examples/magento-storyblok/pages/account/addresses/add.tsx @@ -65,13 +65,14 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account', title: t`Account` } const conf = client.query({ query: StoreConfigDocument }) return { props: { apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account', title: t`Account` }, + up, }, } } diff --git a/examples/magento-storyblok/pages/account/addresses/edit.tsx b/examples/magento-storyblok/pages/account/addresses/edit.tsx index 12cc48cc45b..24fc985781d 100644 --- a/examples/magento-storyblok/pages/account/addresses/edit.tsx +++ b/examples/magento-storyblok/pages/account/addresses/edit.tsx @@ -80,13 +80,14 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account/addresses', title: t`Addresses` } const conf = client.query({ query: StoreConfigDocument }) return { props: { apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account/addresses', title: t`Addresses` }, + up, }, } } diff --git a/examples/magento-storyblok/pages/account/addresses/index.tsx b/examples/magento-storyblok/pages/account/addresses/index.tsx index 88926d82ba1..2f3b3b06999 100644 --- a/examples/magento-storyblok/pages/account/addresses/index.tsx +++ b/examples/magento-storyblok/pages/account/addresses/index.tsx @@ -61,6 +61,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account', title: t`Account` } const staticClient = graphqlSsrClient(context) const conf = client.query({ query: StoreConfigDocument }) @@ -73,7 +74,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { ...(await countryRegions).data, apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account', title: t`Account` }, + up, }, } } diff --git a/examples/magento-storyblok/pages/account/authentication/index.tsx b/examples/magento-storyblok/pages/account/authentication/index.tsx index f1f79c34200..b3d78f3fd4c 100644 --- a/examples/magento-storyblok/pages/account/authentication/index.tsx +++ b/examples/magento-storyblok/pages/account/authentication/index.tsx @@ -69,13 +69,14 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account', title: t`Account` } const conf = client.query({ query: StoreConfigDocument }) return { props: { apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account', title: t`Account` }, + up, }, } } diff --git a/examples/magento-storyblok/pages/account/contact/index.tsx b/examples/magento-storyblok/pages/account/contact/index.tsx index 0cb87797105..97dc388c288 100644 --- a/examples/magento-storyblok/pages/account/contact/index.tsx +++ b/examples/magento-storyblok/pages/account/contact/index.tsx @@ -65,13 +65,14 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account', title: t`Account` } const conf = client.query({ query: StoreConfigDocument }) return { props: { apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account', title: t`Account` }, + up, }, } } diff --git a/examples/magento-storyblok/pages/account/forgot-password.tsx b/examples/magento-storyblok/pages/account/forgot-password.tsx index 92eaa1ca7d5..4a3c623ae5f 100644 --- a/examples/magento-storyblok/pages/account/forgot-password.tsx +++ b/examples/magento-storyblok/pages/account/forgot-password.tsx @@ -50,13 +50,14 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account/signin', title: t`Sign in` } const conf = client.query({ query: StoreConfigDocument }) return { props: { apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account/signin', title: t`Sign in` }, + up, }, } } diff --git a/examples/magento-storyblok/pages/account/index.tsx b/examples/magento-storyblok/pages/account/index.tsx index 9f3691f0529..64c736d8abd 100644 --- a/examples/magento-storyblok/pages/account/index.tsx +++ b/examples/magento-storyblok/pages/account/index.tsx @@ -157,6 +157,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { const staticClient = graphqlSsrClient(context) const client = graphqlSharedClient(context) + const up = { href: '/', title: t`Home` } const conf = client.query({ query: StoreConfigDocument }) const layout = staticClient.query({ query: LayoutDocument, @@ -168,7 +169,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { props: { ...(await layout).data, globalConfig: (await globalConfig)?.content ?? null, - up: { href: '/', title: t`Home` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, revalidate: revalidate(), diff --git a/examples/magento-storyblok/pages/account/name/index.tsx b/examples/magento-storyblok/pages/account/name/index.tsx index 5b6d67c5bfa..94c8527b7a9 100644 --- a/examples/magento-storyblok/pages/account/name/index.tsx +++ b/examples/magento-storyblok/pages/account/name/index.tsx @@ -73,6 +73,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account', title: t`Account` } const conf = client.query({ query: StoreConfigDocument }) if (magentoVersion >= 247) await preloadAttributesForm(client, 'customer_account_edit') @@ -81,7 +82,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { props: { apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account', title: t`Account` }, + up, }, } } diff --git a/examples/magento-storyblok/pages/account/orders/credit-memo.tsx b/examples/magento-storyblok/pages/account/orders/credit-memo.tsx index fc5165f2bb7..987492ae6c2 100644 --- a/examples/magento-storyblok/pages/account/orders/credit-memo.tsx +++ b/examples/magento-storyblok/pages/account/orders/credit-memo.tsx @@ -99,6 +99,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account/orders', title: t`Orders` } const staticClient = graphqlSsrClient(context) const config = client.query({ query: StoreConfigDocument }) @@ -111,7 +112,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { ...(await countryRegions).data, apolloState: await config.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account/orders', title: t`Orders` }, + up, }, } } diff --git a/examples/magento-storyblok/pages/account/orders/index.tsx b/examples/magento-storyblok/pages/account/orders/index.tsx index 3f54425ea57..4540c468567 100644 --- a/examples/magento-storyblok/pages/account/orders/index.tsx +++ b/examples/magento-storyblok/pages/account/orders/index.tsx @@ -86,13 +86,14 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account', title: t`Account` } const conf = client.query({ query: StoreConfigDocument }) return { props: { apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account', title: t`Account` }, + up, }, } } diff --git a/examples/magento-storyblok/pages/account/orders/invoice.tsx b/examples/magento-storyblok/pages/account/orders/invoice.tsx index 07812af6794..be64f5e9b2b 100644 --- a/examples/magento-storyblok/pages/account/orders/invoice.tsx +++ b/examples/magento-storyblok/pages/account/orders/invoice.tsx @@ -96,6 +96,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account/orders', title: t`Orders` } const staticClient = graphqlSsrClient(context) const config = client.query({ query: StoreConfigDocument }) @@ -108,7 +109,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { ...(await countryRegions).data, apolloState: await config.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account/orders', title: t`Orders` }, + up, }, } } diff --git a/examples/magento-storyblok/pages/account/orders/shipment.tsx b/examples/magento-storyblok/pages/account/orders/shipment.tsx index 36006bca0b1..a9903ac906d 100644 --- a/examples/magento-storyblok/pages/account/orders/shipment.tsx +++ b/examples/magento-storyblok/pages/account/orders/shipment.tsx @@ -96,6 +96,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account/orders', title: t`Orders` } const staticClient = graphqlSsrClient(context) const config = client.query({ query: StoreConfigDocument }) @@ -108,7 +109,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { ...(await countryRegions).data, apolloState: await config.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account/orders', title: t`Orders` }, + up, }, } } diff --git a/examples/magento-storyblok/pages/account/orders/view.tsx b/examples/magento-storyblok/pages/account/orders/view.tsx index 7d7560f88d3..e2900d0a120 100644 --- a/examples/magento-storyblok/pages/account/orders/view.tsx +++ b/examples/magento-storyblok/pages/account/orders/view.tsx @@ -96,6 +96,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account/orders', title: t`Orders` } const staticClient = graphqlSsrClient(context) const config = client.query({ query: StoreConfigDocument }) @@ -108,7 +109,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { ...(await countryRegions).data, apolloState: await config.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account/orders', title: t`Orders` }, + up, }, } } diff --git a/examples/magento-storyblok/pages/account/reviews/index.tsx b/examples/magento-storyblok/pages/account/reviews/index.tsx index 3d1215423ea..0cf2594fc7f 100644 --- a/examples/magento-storyblok/pages/account/reviews/index.tsx +++ b/examples/magento-storyblok/pages/account/reviews/index.tsx @@ -79,12 +79,13 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account', title: t`Account` } const conf = client.query({ query: StoreConfigDocument }) return { props: { apolloState: await conf.then(() => client.cache.extract()), - up: { href: '/account', title: t`Account` }, + up, }, } } diff --git a/examples/magento-storyblok/pages/blog/[...url].tsx b/examples/magento-storyblok/pages/blog/[...url].tsx index 5064bec8c86..360d8417922 100644 --- a/examples/magento-storyblok/pages/blog/[...url].tsx +++ b/examples/magento-storyblok/pages/blog/[...url].tsx @@ -133,6 +133,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { const slug = `blog/${params?.url?.join('/') ?? ''}` const client = graphqlSharedClient(context) + const up = { href: '/blog', title: t`Blog` } const staticClient = graphqlSsrClient(context) const conf = client.query({ query: StoreConfigDocument }) const layout = staticClient.query({ @@ -158,7 +159,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { related: (await related).stories, ...(await layout).data, globalConfig: (await globalConfig)?.content ?? null, - up: { href: '/blog', title: t`Blog` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, revalidate: revalidate(), diff --git a/examples/magento-storyblok/pages/blog/tagged/[url].tsx b/examples/magento-storyblok/pages/blog/tagged/[url].tsx index 31352866a29..1bc2802180a 100644 --- a/examples/magento-storyblok/pages/blog/tagged/[url].tsx +++ b/examples/magento-storyblok/pages/blog/tagged/[url].tsx @@ -92,6 +92,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (!tag) return { notFound: true, revalidate: revalidate() } const client = graphqlSharedClient(context) + const up = { href: '/blog', title: t`Blog` } const staticClient = graphqlSsrClient(context) const conf = client.query({ query: StoreConfigDocument }) const layout = staticClient.query({ @@ -116,7 +117,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { stories, ...(await layout).data, globalConfig: (await globalConfig)?.content ?? null, - up: { href: '/blog', title: t`Blog` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, revalidate: revalidate(), diff --git a/examples/magento-storyblok/pages/checkout/customer/addresses/edit.tsx b/examples/magento-storyblok/pages/checkout/customer/addresses/edit.tsx index 18a63b6d1b6..b5fd0e8e79f 100644 --- a/examples/magento-storyblok/pages/checkout/customer/addresses/edit.tsx +++ b/examples/magento-storyblok/pages/checkout/customer/addresses/edit.tsx @@ -96,13 +96,14 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCartDisabled(context.locale) || getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/checkout', title: t`Shipping` } const conf = client.query({ query: StoreConfigDocument }) return { props: { apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/checkout', title: t`Shipping` }, + up, }, } } diff --git a/examples/magento-storyblok/pages/checkout/index.tsx b/examples/magento-storyblok/pages/checkout/index.tsx index 70abd6ac15d..8e6ce6d00a3 100644 --- a/examples/magento-storyblok/pages/checkout/index.tsx +++ b/examples/magento-storyblok/pages/checkout/index.tsx @@ -156,6 +156,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCheckoutIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/cart', title: t`Cart` } const conf = client.query({ query: StoreConfigDocument }) const staticClient = graphqlSsrClient(context) @@ -169,7 +170,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { props: { ...(await layout).data, globalConfig: (await globalConfig)?.content ?? null, - up: { href: '/cart', title: t`Cart` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, } diff --git a/examples/magento-storyblok/pages/checkout/payment.tsx b/examples/magento-storyblok/pages/checkout/payment.tsx index 6772c8dcc38..066fb28d6ff 100644 --- a/examples/magento-storyblok/pages/checkout/payment.tsx +++ b/examples/magento-storyblok/pages/checkout/payment.tsx @@ -159,6 +159,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCheckoutIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/checkout', title: t`Shipping` } const staticClient = graphqlSsrClient(context) const conf = client.query({ query: StoreConfigDocument }) @@ -172,7 +173,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { props: { ...(await layout).data, globalConfig: (await globalConfig)?.content ?? null, - up: { href: '/checkout', title: t`Shipping` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, } diff --git a/examples/magento-storyblok/pages/checkout/success.tsx b/examples/magento-storyblok/pages/checkout/success.tsx index aa33f21304d..6c5a2617c32 100644 --- a/examples/magento-storyblok/pages/checkout/success.tsx +++ b/examples/magento-storyblok/pages/checkout/success.tsx @@ -100,6 +100,7 @@ export default OrderSuccessPage export const getStaticProps: GetPageStaticProps = async (context) => { if (getCheckoutIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/', title: t`Home` } const staticClient = graphqlSsrClient(context) const conf = client.query({ query: StoreConfigDocument }) const layout = staticClient.query({ @@ -111,7 +112,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { props: { ...(await layout).data, globalConfig: (await globalConfig)?.content ?? null, - up: { href: '/', title: t`Home` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, } diff --git a/examples/magento-storyblok/pages/customer/account/createPassword.tsx b/examples/magento-storyblok/pages/customer/account/createPassword.tsx index 505f3a28827..9ba2529f1d4 100644 --- a/examples/magento-storyblok/pages/customer/account/createPassword.tsx +++ b/examples/magento-storyblok/pages/customer/account/createPassword.tsx @@ -83,13 +83,14 @@ export const getStaticProps: GetPageStaticProps = async (context) => { if (getCustomerAccountIsDisabled(context.locale)) return { notFound: true } const client = graphqlSharedClient(context) + const up = { href: '/account/signin', title: t`Sign in` } const conf = client.query({ query: StoreConfigDocument }) return { props: { apolloState: await conf.then(() => client.cache.extract()), variantMd: 'bottom', - up: { href: '/account/signin', title: t`Sign in` }, + up, }, } } diff --git a/examples/magento-storyblok/pages/p/[url].tsx b/examples/magento-storyblok/pages/p/[url].tsx index b82569dd150..8814d5b36c4 100644 --- a/examples/magento-storyblok/pages/p/[url].tsx +++ b/examples/magento-storyblok/pages/p/[url].tsx @@ -213,6 +213,7 @@ export const getStaticPaths: GetPageStaticPaths = async ({ locales = [] }) => { export const getStaticProps: GetPageStaticProps = async (context) => { const { locale, params } = context const client = graphqlSharedClient(context) + const homeUp = { href: '/', title: t`Home` } const staticClient = graphqlSsrClient(context) const urlKey = params?.url ?? '??' @@ -241,7 +242,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { const up = category?.url_path && category?.name ? { href: `/${category.url_path}`, title: category.name } - : { href: '/', title: t`Home` } + : homeUp const result = { props: { diff --git a/examples/magento-storyblok/pages/search/[[...url]].tsx b/examples/magento-storyblok/pages/search/[[...url]].tsx index 4d26ac08e00..9a020c42cea 100644 --- a/examples/magento-storyblok/pages/search/[[...url]].tsx +++ b/examples/magento-storyblok/pages/search/[[...url]].tsx @@ -90,6 +90,7 @@ export const getServerSideProps: GetPageStaticProps = async (context) => { const search = searchShort.length >= 3 ? searchShort : '' const client = graphqlSharedClient(context) + const up = { href: '/', title: t`Home` } const conf = client.query({ query: StoreConfigDocument }) const filterTypes = getFilterTypes(client, true) @@ -140,7 +141,7 @@ export const getServerSideProps: GetPageStaticProps = async (context) => { globalConfig: (await globalConfig)?.content ?? null, filterTypes: await filterTypes, params: productListParams, - up: { href: '/', title: t`Home` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, } diff --git a/examples/magento-storyblok/pages/service/[[...url]].tsx b/examples/magento-storyblok/pages/service/[[...url]].tsx index 8cf57b3e7f5..83c56244d5a 100644 --- a/examples/magento-storyblok/pages/service/[[...url]].tsx +++ b/examples/magento-storyblok/pages/service/[[...url]].tsx @@ -71,6 +71,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { const isRoot = slug === 'service' const client = graphqlSharedClient(context) + const up = isRoot ? null : { href: '/service', title: t`Customer Service` } const staticClient = graphqlSsrClient(context) const conf = client.query({ query: StoreConfigDocument }) const layout = staticClient.query({ @@ -87,7 +88,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { props: { story, ...(await layout).data, - up: isRoot ? null : { href: '/service', title: t`Customer Service` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, revalidate: revalidate(), diff --git a/examples/magento-storyblok/pages/service/contact-us.tsx b/examples/magento-storyblok/pages/service/contact-us.tsx index 944d69d28bf..ec0999da220 100644 --- a/examples/magento-storyblok/pages/service/contact-us.tsx +++ b/examples/magento-storyblok/pages/service/contact-us.tsx @@ -57,6 +57,7 @@ export default ContactUs export const getStaticProps: GetPageStaticProps = async (context) => { const client = graphqlSharedClient(context) + const up = { href: '/service', title: t`Customer Service` } const staticClient = graphqlSsrClient(context) const conf = client.query({ query: StoreConfigDocument }) const layout = staticClient.query({ @@ -72,7 +73,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { props: { story: (await storyPage).data?.story ?? null, ...(await layout).data, - up: { href: '/service', title: t`Customer Service` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, revalidate: revalidate(), diff --git a/examples/magento-storyblok/pages/service/newsletter.tsx b/examples/magento-storyblok/pages/service/newsletter.tsx index 2c71dd99c76..6420214ca3c 100644 --- a/examples/magento-storyblok/pages/service/newsletter.tsx +++ b/examples/magento-storyblok/pages/service/newsletter.tsx @@ -61,6 +61,7 @@ export default NewsletterSubscribe export const getStaticProps: GetPageStaticProps = async (context) => { const client = graphqlSharedClient(context) + const up = { href: '/service', title: t`Customer Service` } const staticClient = graphqlSsrClient(context) const conf = client.query({ query: StoreConfigDocument }) const layout = staticClient.query({ @@ -74,7 +75,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { props: { story: (await storyPage).data?.story ?? null, ...(await layout).data, - up: { href: '/service', title: t`Customer Service` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, revalidate: revalidate(), diff --git a/packages/demo-magento-graphcommerce/copy/pages/test/[[...url]].tsx b/packages/demo-magento-graphcommerce/copy/pages/test/[[...url]].tsx index 934fcd41cd3..691a41482b1 100644 --- a/packages/demo-magento-graphcommerce/copy/pages/test/[[...url]].tsx +++ b/packages/demo-magento-graphcommerce/copy/pages/test/[[...url]].tsx @@ -65,6 +65,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { const url = (params?.url ?? ['index']).join('/') ?? '' const client = graphqlSharedClient(context) + const up = url !== 'index' ? { href: '/', title: t`Home` } : null const staticClient = graphqlSsrClient(context) const conf = client.query({ query: StoreConfigDocument }) @@ -76,7 +77,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { return { props: { url, - up: url !== 'index' ? { href: '/', title: t`Home` } : null, + up, ...(await layout).data, apolloState: await conf.then(() => client.cache.extract()), }, diff --git a/packages/demo-magento-graphcommerce/copy/pages/test/slider.tsx b/packages/demo-magento-graphcommerce/copy/pages/test/slider.tsx index 92918d2394c..f35db2bd505 100644 --- a/packages/demo-magento-graphcommerce/copy/pages/test/slider.tsx +++ b/packages/demo-magento-graphcommerce/copy/pages/test/slider.tsx @@ -88,6 +88,7 @@ export default TestSlider export const getStaticProps: GetPageStaticProps = async (context) => { const client = graphqlSharedClient(context) + const up = { href: '/', title: t`Home` } const staticClient = graphqlSsrClient(context) const conf = client.query({ query: StoreConfigDocument }) @@ -101,7 +102,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { return { props: { ...(await productList).data, - up: { href: '/', title: t`Home` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, } diff --git a/packages/demo-magento-graphcommerce/copy/pages/test/typography.tsx b/packages/demo-magento-graphcommerce/copy/pages/test/typography.tsx index d280255775f..f66194e5847 100644 --- a/packages/demo-magento-graphcommerce/copy/pages/test/typography.tsx +++ b/packages/demo-magento-graphcommerce/copy/pages/test/typography.tsx @@ -198,6 +198,7 @@ export default TypographyOverview export const getStaticProps: GetPageStaticProps = async (context) => { const client = graphqlSharedClient(context) + const up = { href: '/', title: t`Home` } const staticClient = graphqlSsrClient(context) const conf = client.query({ query: StoreConfigDocument }) @@ -209,7 +210,7 @@ export const getStaticProps: GetPageStaticProps = async (context) => { return { props: { ...(await layout).data, - up: { href: '/', title: t`Home` }, + up, apolloState: await conf.then(() => client.cache.extract()), }, } From 1dc4e9e6fc7fc87cc1d3b101144365fe93eed359 Mon Sep 17 00:00:00 2001 From: Giovanni-Schroevers Date: Thu, 2 Jul 2026 12:15:41 +0200 Subject: [PATCH 2/2] chore: add changeset for breadcrumb up-link locale race fix Co-Authored-By: Claude Opus 4.8 --- .changeset/breadcrumb-up-locale-race.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/breadcrumb-up-locale-race.md diff --git a/.changeset/breadcrumb-up-locale-race.md b/.changeset/breadcrumb-up-locale-race.md new file mode 100644 index 00000000000..c2416ba721c --- /dev/null +++ b/.changeset/breadcrumb-up-locale-race.md @@ -0,0 +1,5 @@ +--- +'@graphcommerce/demo-magento-graphcommerce': patch +--- + +Fix breadcrumb "up" link title being translated in the wrong locale during static generation. The Lingui `t` macro title was evaluated inside the returned props after awaiting GraphQL queries, so a concurrent static-generation request for another locale could change the global active locale mid-flight. The `up` object is now computed synchronously before any await, capturing the correct locale for the current request.