From 65fc690787b9ed68d7031d87606c5efc95f8ac6f Mon Sep 17 00:00:00 2001 From: Amritanshu Date: Wed, 23 Oct 2024 10:05:38 +0530 Subject: [PATCH] Async request api codemod --- src/app/(storefront)/products/[handle]/page.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/app/(storefront)/products/[handle]/page.tsx b/src/app/(storefront)/products/[handle]/page.tsx index a9a6de8..3fb63f9 100644 --- a/src/app/(storefront)/products/[handle]/page.tsx +++ b/src/app/(storefront)/products/[handle]/page.tsx @@ -10,9 +10,9 @@ function shuffleArray(array: T[]) { } interface ProductPageProps { - params: { + params: Promise<{ handle: string; - }; + }>; } async function fetchProduct(handle: string, region: HttpTypes.StoreRegion | undefined) { @@ -91,7 +91,8 @@ async function fetchProducts(region: HttpTypes.StoreRegion | undefined, count: n } } -export default async function ProductPage({ params }: ProductPageProps) { +export default async function ProductPage(props: ProductPageProps) { + const params = await props.params; // const { region } = useRegion(); const { handle } = params; // Extract the handle from the params const product: HttpTypes.StoreProduct = await fetchProduct(handle, undefined); @@ -99,6 +100,6 @@ export default async function ProductPage({ params }: ProductPageProps) { return ( // Render the client component and pass necessary props - + () ); }