From d88cabf68351c8faea8b820113961743a7cf34ac Mon Sep 17 00:00:00 2001 From: Lee Robinson Date: Wed, 8 Nov 2023 15:04:50 -0600 Subject: [PATCH] Use Suspense --- app/product/[handle]/page.tsx | 15 +++++++++------ components/layout/navbar/index.tsx | 8 ++++++-- components/layout/navbar/mobile-menu.tsx | 6 ++++-- components/layout/search/filter/index.tsx | 9 +++++++-- components/product/product-description.tsx | 9 +++++++-- 5 files changed, 33 insertions(+), 14 deletions(-) diff --git a/app/product/[handle]/page.tsx b/app/product/[handle]/page.tsx index f9908e80c..c7b759841 100644 --- a/app/product/[handle]/page.tsx +++ b/app/product/[handle]/page.tsx @@ -9,6 +9,7 @@ import { HIDDEN_PRODUCT_TAG } from 'lib/constants'; import { getProduct, getProductRecommendations } from 'lib/shopify'; import { Image } from 'lib/shopify/types'; import Link from 'next/link'; +import { Suspense } from 'react'; export async function generateMetadata({ params @@ -81,12 +82,14 @@ export default async function ProductPage({ params }: { params: { handle: string
- ({ - src: image.url, - altText: image.altText - }))} - /> + + ({ + src: image.url, + altText: image.altText + }))} + /> +
diff --git a/components/layout/navbar/index.tsx b/components/layout/navbar/index.tsx index 0058d5ec8..6345629ab 100644 --- a/components/layout/navbar/index.tsx +++ b/components/layout/navbar/index.tsx @@ -15,7 +15,9 @@ export default async function Navbar() { return ( diff --git a/components/product/product-description.tsx b/components/product/product-description.tsx index a81a6b02c..10232ae3d 100644 --- a/components/product/product-description.tsx +++ b/components/product/product-description.tsx @@ -2,6 +2,7 @@ import { AddToCart } from 'components/cart/add-to-cart'; import Price from 'components/price'; import Prose from 'components/prose'; import { Product } from 'lib/shopify/types'; +import { Suspense } from 'react'; import { VariantSelector } from './variant-selector'; export function ProductDescription({ product }: { product: Product }) { @@ -16,7 +17,9 @@ export function ProductDescription({ product }: { product: Product }) { />
- + + + {product.descriptionHtml ? ( ) : null} - + + + ); }