Merge pull request #18 from zenzen-sol/sol/2023-11-12-merge-test

fix: Issue with shoplist
This commit is contained in:
Sol Irvine 2023-11-13 13:49:34 +09:00 committed by GitHub
commit 84a8a087db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 4 deletions

View File

@ -1,8 +1,16 @@
import { SupportedLocale } from 'components/layout/navbar/language-control';
import OpengraphImage from 'components/opengraph-image'; import OpengraphImage from 'components/opengraph-image';
import { getPage } from 'lib/shopify'; import { getPage } from 'lib/shopify';
export default async function Image({ params }: { params: { page: string } }) { export default async function Image({
const page = await getPage({ handle: params.page }); 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; const title = page.seo?.title || page.title;
return await OpengraphImage({ title }); return await OpengraphImage({ title });

View File

@ -5,6 +5,7 @@ import Navbar from 'components/layout/navbar';
import { SupportedLocale } from 'components/layout/navbar/language-control'; import { SupportedLocale } from 'components/layout/navbar/language-control';
import { getCart, getPage, getProduct } from 'lib/shopify'; import { getCart, getPage, getProduct } from 'lib/shopify';
import { Product } from 'lib/shopify/types'; import { Product } from 'lib/shopify/types';
import { unstable_noStore } from 'next/cache';
import { cookies } from 'next/headers'; import { cookies } from 'next/headers';
import { notFound } from 'next/navigation'; import { notFound } from 'next/navigation';
import { Suspense } from 'react'; import { Suspense } from 'react';
@ -16,6 +17,7 @@ export async function generateMetadata({
}: { }: {
params: { locale?: SupportedLocale }; params: { locale?: SupportedLocale };
}): Promise<Metadata> { }): Promise<Metadata> {
unstable_noStore(); // opt out before we even get to the try/catch
const page = await getPage({ const page = await getPage({
handle: 'shop-list', handle: 'shop-list',
language: params?.locale?.toUpperCase() || 'JA' language: params?.locale?.toUpperCase() || 'JA'

View File

@ -400,7 +400,7 @@ export async function getPage({
}): Promise<Page> { }): Promise<Page> {
const res = await shopifyFetch<ShopifyPageOperation>({ const res = await shopifyFetch<ShopifyPageOperation>({
query: getPageQuery, query: getPageQuery,
// cache: 'no-store', cache: 'no-store',
variables: { handle, language, country } variables: { handle, language, country }
}); });
@ -416,7 +416,7 @@ export async function getPages({
}): Promise<Page[]> { }): Promise<Page[]> {
const res = await shopifyFetch<ShopifyPagesOperation>({ const res = await shopifyFetch<ShopifyPagesOperation>({
query: getPagesQuery, query: getPagesQuery,
// cache: 'no-store', cache: 'no-store',
variables: { language, country } variables: { language, country }
}); });