From 0ce215fa7584ec9db2a1ac1a498ba7e30b48dd5d Mon Sep 17 00:00:00 2001 From: Sol Irvine Date: Mon, 13 Nov 2023 13:40:33 +0900 Subject: [PATCH] fix: Issue with shoplist --- app/[locale]/shop-list/opengraph-image.tsx | 12 ++++++++++-- app/[locale]/shop-list/page.tsx | 2 ++ lib/shopify/index.ts | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/[locale]/shop-list/opengraph-image.tsx b/app/[locale]/shop-list/opengraph-image.tsx index e1723449e..18d356bf8 100644 --- a/app/[locale]/shop-list/opengraph-image.tsx +++ b/app/[locale]/shop-list/opengraph-image.tsx @@ -1,8 +1,16 @@ +import { SupportedLocale } from 'components/layout/navbar/language-control'; import OpengraphImage from 'components/opengraph-image'; import { getPage } from 'lib/shopify'; -export default async function Image({ params }: { params: { page: string } }) { - const page = await getPage({ handle: params.page }); +export default async function Image({ + params +}: { + params: { page: string; locale?: SupportedLocale }; +}) { + const page = await getPage({ + handle: params.page, + language: params?.locale?.toUpperCase() || 'JA' + }); const title = page.seo?.title || page.title; return await OpengraphImage({ title }); diff --git a/app/[locale]/shop-list/page.tsx b/app/[locale]/shop-list/page.tsx index b264f2b66..3d11373ea 100644 --- a/app/[locale]/shop-list/page.tsx +++ b/app/[locale]/shop-list/page.tsx @@ -5,6 +5,7 @@ import Navbar from 'components/layout/navbar'; import { SupportedLocale } from 'components/layout/navbar/language-control'; import { getCart, getPage, getProduct } from 'lib/shopify'; import { Product } from 'lib/shopify/types'; +import { unstable_noStore } from 'next/cache'; import { cookies } from 'next/headers'; import { notFound } from 'next/navigation'; import { Suspense } from 'react'; @@ -16,6 +17,7 @@ export async function generateMetadata({ }: { params: { locale?: SupportedLocale }; }): Promise { + unstable_noStore(); // opt out before we even get to the try/catch const page = await getPage({ handle: 'shop-list', language: params?.locale?.toUpperCase() || 'JA' diff --git a/lib/shopify/index.ts b/lib/shopify/index.ts index 9385360dd..8a53bc039 100644 --- a/lib/shopify/index.ts +++ b/lib/shopify/index.ts @@ -400,7 +400,7 @@ export async function getPage({ }): Promise { const res = await shopifyFetch({ query: getPageQuery, - // cache: 'no-store', + cache: 'no-store', variables: { handle, language, country } }); @@ -416,7 +416,7 @@ export async function getPages({ }): Promise { const res = await shopifyFetch({ query: getPagesQuery, - // cache: 'no-store', + cache: 'no-store', variables: { language, country } });