mirror of
https://github.com/vercel/commerce.git
synced 2025-05-15 05:56:59 +00:00
Removed suspense
This commit is contained in:
parent
103c7809c3
commit
cc2fb3543e
@ -1,25 +1,24 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
|
import { InfoCircledIcon } from '@radix-ui/react-icons';
|
||||||
|
|
||||||
import BlurbSection from '@/components/modules/blurb-section/blurb-section';
|
import BlurbSection from '@/components/modules/blurb-section/blurb-section';
|
||||||
import FilteredProductList from '@/components/modules/filtered-product-list/filtered-product-list';
|
import FilteredProductList from '@/components/modules/filtered-product-list/filtered-product-list';
|
||||||
import Hero from '@/components/modules/hero';
|
import Hero from '@/components/modules/hero';
|
||||||
import ReusableSection from '@/components/modules/reusable-section/reusable-section';
|
import ReusableSection from '@/components/modules/reusable-section/reusable-section';
|
||||||
import Slider from '@/components/modules/slider/slider';
|
import Slider from '@/components/modules/slider/slider';
|
||||||
import USPSection from '@/components/modules/usp-section/usp-section';
|
import USPSection from '@/components/modules/usp-section/usp-section';
|
||||||
import { InfoCircledIcon } from '@radix-ui/react-icons';
|
|
||||||
import { Suspense } from 'react';
|
|
||||||
interface getContentComponentProps {
|
interface getContentComponentProps {
|
||||||
_type: string;
|
_type: string;
|
||||||
_key: number;
|
_key: number;
|
||||||
disabled: boolean;
|
disabled: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const getContentComponent = (
|
const getContentComponent = ({ _type, _key, disabled, ...rest }: getContentComponentProps) => {
|
||||||
{ _type, _key, disabled, ...rest }: getContentComponentProps,
|
|
||||||
index: number
|
|
||||||
) => {
|
|
||||||
let Component: any;
|
let Component: any;
|
||||||
|
|
||||||
|
console.log(_key);
|
||||||
|
|
||||||
switch (_type) {
|
switch (_type) {
|
||||||
case 'hero':
|
case 'hero':
|
||||||
Component = Hero;
|
Component = Hero;
|
||||||
@ -68,16 +67,7 @@ const getContentComponent = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Component ? (
|
return Component ? (
|
||||||
index == 0 ? (
|
|
||||||
<Component key={`index-${_key}`} {...rest} />
|
<Component key={`index-${_key}`} {...rest} />
|
||||||
) : (
|
|
||||||
<Suspense
|
|
||||||
key={`index-${_key}`}
|
|
||||||
fallback={<h2 className="font-bold text-high-contrast">Loading...</h2>}
|
|
||||||
>
|
|
||||||
<Component {...rest} />
|
|
||||||
</Suspense>
|
|
||||||
)
|
|
||||||
) : (
|
) : (
|
||||||
<div key={`index-${_key}`}>Something else</div>
|
<div key={`index-${_key}`}>Something else</div>
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user