Test to add suspense to dynamic content

This commit is contained in:
Henrik Larsson 2023-08-28 15:26:01 +02:00
parent f2c7f184f2
commit 8849edfc8a

View File

@ -6,6 +6,7 @@ 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 { InformationCircleIcon } from '@heroicons/react/24/outline'; import { InformationCircleIcon } from '@heroicons/react/24/outline';
import { Suspense } from 'react';
interface getContentComponentProps { interface getContentComponentProps {
_type: string; _type: string;
_key: number; _key: number;
@ -87,7 +88,9 @@ interface dynamicContentManagerProps {
const DynamicContentManager = ({ content }: dynamicContentManagerProps) => { const DynamicContentManager = ({ content }: dynamicContentManagerProps) => {
return ( return (
<div className="dynamic-content overflow-x-hidden">{content?.map(getContentComponent)}</div> <div className="dynamic-content overflow-x-hidden">
<Suspense fallback={<div>Loading...</div>}>{content?.map(getContentComponent)}</Suspense>
</div>
); );
}; };