mirror of
https://github.com/vercel/commerce.git
synced 2025-05-19 16:07:01 +00:00
Updated TypeScript to resolve async RSC error
This commit is contained in:
parent
336ae78a4b
commit
a34b4b628c
@ -1,10 +1,8 @@
|
||||
import Footer from '@/components/layout/footer/footer';
|
||||
import DynamicContentManager from 'components/layout/dynamic-content-manager';
|
||||
import { pageQuery } from 'lib/sanity/queries';
|
||||
import { clientFetch } from 'lib/sanity/sanity.client';
|
||||
import type { Metadata } from 'next';
|
||||
import { notFound } from 'next/navigation';
|
||||
import { Suspense } from 'react';
|
||||
|
||||
export const runtime = 'edge';
|
||||
|
||||
@ -75,12 +73,5 @@ export default async function Page({ params }: PageParams) {
|
||||
|
||||
if (!page) return notFound();
|
||||
|
||||
return (
|
||||
<>
|
||||
<DynamicContentManager content={page?.content} />
|
||||
<Suspense>
|
||||
<Footer locale={params.locale} />
|
||||
</Suspense>
|
||||
</>
|
||||
);
|
||||
return <DynamicContentManager content={page?.content} />;
|
||||
}
|
||||
|
@ -1,10 +1,8 @@
|
||||
import Footer from '@/components/layout/footer/footer';
|
||||
import Text from 'components/ui/text/text';
|
||||
import { categoryQuery } from 'lib/sanity/queries';
|
||||
import { clientFetch } from 'lib/sanity/sanity.client';
|
||||
import { Metadata } from 'next';
|
||||
import { notFound } from 'next/navigation';
|
||||
import { Suspense } from 'react';
|
||||
|
||||
export async function generateMetadata({
|
||||
params
|
||||
@ -38,9 +36,6 @@ export default async function ProductPage({ params }: CategoryPageParams) {
|
||||
return (
|
||||
<div className="mb-8 flex w-full flex-col px-4 lg:my-16 lg:px-8 2xl:px-16">
|
||||
<Text variant={'pageHeading'}>{title}</Text>
|
||||
<Suspense>
|
||||
<Footer locale={params.locale} />
|
||||
</Suspense>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import Footer from 'components/layout/footer/footer';
|
||||
import Header from 'components/layout/header/header';
|
||||
import { NextIntlClientProvider } from 'next-intl';
|
||||
import { Inter } from 'next/font/google';
|
||||
@ -59,6 +60,7 @@ export default async function LocaleLayout({ children, params: { locale } }: Loc
|
||||
<Header locale={locale} />
|
||||
<Suspense>
|
||||
<main className="flex-1">{children}</main>
|
||||
<Footer locale={locale} />
|
||||
</Suspense>
|
||||
</NextIntlClientProvider>
|
||||
</body>
|
||||
|
@ -1,10 +1,8 @@
|
||||
import Footer from '@/components/layout/footer/footer';
|
||||
import DynamicContentManager from 'components/layout/dynamic-content-manager/dynamic-content-manager';
|
||||
import { homePageQuery } from 'lib/sanity/queries';
|
||||
import { clientFetch } from 'lib/sanity/sanity.client';
|
||||
import { Metadata } from 'next';
|
||||
import { notFound } from 'next/navigation';
|
||||
import { Suspense } from 'react';
|
||||
export const runtime = 'edge';
|
||||
|
||||
export async function generateMetadata({
|
||||
@ -34,9 +32,6 @@ export default async function HomePage({ params }: HomePageParams) {
|
||||
return (
|
||||
<>
|
||||
<DynamicContentManager content={data?.content} />
|
||||
<Suspense>
|
||||
<Footer locale={params.locale} />
|
||||
</Suspense>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
@ -1,10 +1,8 @@
|
||||
import Footer from '@/components/layout/footer/footer';
|
||||
import ProductView from 'components/product/product-view';
|
||||
import { productQuery } from 'lib/sanity/queries';
|
||||
import { clientFetch } from 'lib/sanity/sanity.client';
|
||||
import type { Metadata } from 'next';
|
||||
import { notFound } from 'next/navigation';
|
||||
import { Suspense } from 'react';
|
||||
|
||||
interface ProductPageParams {
|
||||
params: {
|
||||
@ -85,10 +83,7 @@ export default async function ProductPage({ params }: ProductPageParams) {
|
||||
__html: JSON.stringify(productJsonLd)
|
||||
}}
|
||||
/>
|
||||
<ProductView product={product} relatedProducts={[]} />
|
||||
<Suspense>
|
||||
<Footer locale={params.locale} />
|
||||
</Suspense>
|
||||
<ProductView product={product} relatedProducts={[]} />;
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user