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