Removed suspense

This commit is contained in:
Henrik Larsson 2023-08-08 21:56:25 +02:00
parent 103c7809c3
commit cc2fb3543e

View File

@ -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>
); );