diff --git a/app/(cms)/[...cms]/page.tsx b/app/(cms)/[...cms]/page.tsx index b7f6d8e72..8afa7edeb 100644 --- a/app/(cms)/[...cms]/page.tsx +++ b/app/(cms)/[...cms]/page.tsx @@ -4,15 +4,11 @@ import Prose from 'components/prose'; import { getPage } from 'lib/shopware'; import { notFound } from 'next/navigation'; -export const runtime = 'edge'; +export const runtime = 'nodejs'; export const revalidate = 43200; // 12 hours in seconds -export async function generateMetadata({ - params -}: { - params: { cms: string }; -}): Promise<Metadata> { +export async function generateMetadata({ params }: { params: { cms: string } }): Promise<Metadata> { const page = await getPage(params.cms); if (!page) return notFound(); diff --git a/app/(cms)/opengraph-image.tsx b/app/(cms)/opengraph-image.tsx index db45917a7..9f954dde6 100644 --- a/app/(cms)/opengraph-image.tsx +++ b/app/(cms)/opengraph-image.tsx @@ -1,7 +1,7 @@ import OpengraphImage from 'components/opengraph-image'; import { getPage } from 'lib/shopware'; -export const runtime = 'edge'; +export const runtime = 'nodejs'; export default async function Image({ params }: { params: { page: string } }) { const page = await getPage(params.page); diff --git a/app/api/revalidate/route.ts b/app/api/revalidate/route.ts index 94ddfff9b..da250294c 100644 --- a/app/api/revalidate/route.ts +++ b/app/api/revalidate/route.ts @@ -3,7 +3,7 @@ import { revalidateTag } from 'next/cache'; import { headers } from 'next/headers'; import { NextRequest, NextResponse } from 'next/server'; -export const runtime = 'edge'; +export const runtime = 'nodejs'; // We always need to respond with a 200 status code to Shopify, // otherwise it will continue to retry the request. diff --git a/app/opengraph-image.tsx b/app/opengraph-image.tsx index 23762cbdd..29e3f703a 100644 --- a/app/opengraph-image.tsx +++ b/app/opengraph-image.tsx @@ -1,6 +1,6 @@ import OpengraphImage from 'components/opengraph-image'; -export const runtime = 'edge'; +export const runtime = 'nodejs'; export default async function Image() { return await OpengraphImage(); diff --git a/app/page.tsx b/app/page.tsx index 5f357726a..e1bd0d998 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -3,7 +3,7 @@ import { ThreeItemGrid } from 'components/grid/three-items'; import Footer from 'components/layout/footer'; import { Suspense } from 'react'; -export const runtime = 'edge'; +export const runtime = 'nodejs'; export const metadata = { description: 'High-performance ecommerce store built with Next.js, Vercel, and Shopware.', diff --git a/app/product/[...handle]/page.tsx b/app/product/[...handle]/page.tsx index 573fe475b..6f7a76400 100644 --- a/app/product/[...handle]/page.tsx +++ b/app/product/[...handle]/page.tsx @@ -13,7 +13,7 @@ import { HIDDEN_PRODUCT_TAG } from 'lib/constants'; import { getProduct, getProductRecommendations } from 'lib/shopware'; import { Image } from 'lib/shopware/types'; -export const runtime = 'edge'; +export const runtime = 'nodejs'; export async function generateMetadata({ params diff --git a/app/search/(collection)/[...collection]/page.tsx b/app/search/(collection)/[...collection]/page.tsx index 7de68dae9..c4d1950a5 100644 --- a/app/search/(collection)/[...collection]/page.tsx +++ b/app/search/(collection)/[...collection]/page.tsx @@ -10,7 +10,7 @@ import Pagination from 'components/collection/pagination'; import { getCollection, getCollectionProducts } from 'lib/shopware'; import { defaultSort, sorting } from 'lib/constants'; -export const runtime = 'edge'; +export const runtime = 'nodejs'; export async function generateMetadata({ params diff --git a/app/search/(collection)/opengraph-image.tsx b/app/search/(collection)/opengraph-image.tsx index 98cd40853..d1e08d1f7 100644 --- a/app/search/(collection)/opengraph-image.tsx +++ b/app/search/(collection)/opengraph-image.tsx @@ -1,7 +1,7 @@ import OpengraphImage from 'components/opengraph-image'; import { getCollection } from 'lib/shopware'; -export const runtime = 'edge'; +export const runtime = 'nodejs'; export default async function Image({ params }: { params: { collection: string } }) { const collection = await getCollection(params.collection); diff --git a/app/search/page.tsx b/app/search/page.tsx index a8940ac44..5200149ec 100644 --- a/app/search/page.tsx +++ b/app/search/page.tsx @@ -4,7 +4,7 @@ import FilterList from 'components/layout/search/filter'; import { defaultSort, sorting } from 'lib/constants'; import { getSearchCollectionProducts } from 'lib/shopware'; -export const runtime = 'edge'; +export const runtime = 'nodejs'; export const metadata = { title: 'Search', @@ -23,16 +23,17 @@ export default async function SearchPage({ const resultsText = products.length > 1 ? 'results' : 'result'; return ( - <>{searchValue && products.length === 0 ? ( - <div className='mx-auto flex max-w-7xl flex-col bg-white py-6 text-black dark:bg-black dark:text-white md:flex-row'> - <p> - {'There are no products that match '} - <span className="font-bold">"{searchValue}"</span> - </p> - </div> - ) : null} + <> + {searchValue && products.length === 0 ? ( + <div className="mx-auto flex max-w-7xl flex-col bg-white py-6 text-black dark:bg-black dark:text-white md:flex-row"> + <p> + {'There are no products that match '} + <span className="font-bold">"{searchValue}"</span> + </p> + </div> + ) : null} {products.length > 0 ? ( - <div className='mx-auto flex max-w-7xl flex-col bg-white py-6 text-black dark:bg-black dark:text-white md:flex-row'> + <div className="mx-auto flex max-w-7xl flex-col bg-white py-6 text-black dark:bg-black dark:text-white md:flex-row"> <div className="order-first flex-none md:w-1/6"> {searchValue ? ( <p> @@ -40,7 +41,7 @@ export default async function SearchPage({ <span className="font-bold">"{searchValue}"</span> </p> ) : null} - <p className='pt-4'>Good place to add other suggest search terms ;)</p> + <p className="pt-4">Good place to add other suggest search terms ;)</p> </div> <Grid className="grid-cols-2 lg:grid-cols-3"> <ProductGridItems products={products} /> diff --git a/lib/shopware/api.ts b/lib/shopware/api.ts index b89f33ca2..81985dc5f 100644 --- a/lib/shopware/api.ts +++ b/lib/shopware/api.ts @@ -105,7 +105,6 @@ export async function requestSeoUrl( page: number = 1, limit: number = 1 ): Promise<SeoURLResultSW> { - const fixedHandle = handle.replace('%2F', '/'); return await apiInstance.invoke('readSeoUrl post /seo-url', { page: page, limit: limit, @@ -118,12 +117,12 @@ export async function requestSeoUrl( { type: 'equals', field: 'seoPathInfo', - value: fixedHandle + '/' + value: handle + '/' }, { type: 'equals', field: 'seoPathInfo', - value: fixedHandle + value: handle } ] }