From 179b92d5d8705d04c51795b5e8b7ce0aec5edf39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Meyer?= Date: Fri, 14 Jul 2023 13:04:52 +0200 Subject: [PATCH] feat(poc): cahnge runtime for test --- app/(cms)/[...cms]/page.tsx | 8 ++----- app/(cms)/opengraph-image.tsx | 2 +- app/api/revalidate/route.ts | 2 +- app/opengraph-image.tsx | 2 +- app/page.tsx | 2 +- app/product/[...handle]/page.tsx | 2 +- .../(collection)/[...collection]/page.tsx | 2 +- app/search/(collection)/opengraph-image.tsx | 2 +- app/search/page.tsx | 23 ++++++++++--------- lib/shopware/api.ts | 5 ++-- 10 files changed, 23 insertions(+), 27 deletions(-) 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 { +export async function generateMetadata({ params }: { params: { cms: string } }): Promise { 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 ? ( -
-

- {'There are no products that match '} - "{searchValue}" -

-
- ) : null} + <> + {searchValue && products.length === 0 ? ( +
+

+ {'There are no products that match '} + "{searchValue}" +

+
+ ) : null} {products.length > 0 ? ( -
+
{searchValue ? (

@@ -40,7 +41,7 @@ export default async function SearchPage({ "{searchValue}"

) : null} -

Good place to add other suggest search terms ;)

+

Good place to add other suggest search terms ;)

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 { - 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 } ] }