Added suspense around dynamic content manager

This commit is contained in:
Henrik Larsson 2023-08-29 20:45:45 +02:00
parent 7d9730718d
commit 8eb80b2f4b

View File

@ -4,6 +4,7 @@ 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 { Suspense } from 'react';
interface getContentComponentProps { interface getContentComponentProps {
_type: string; _type: string;
@ -49,7 +50,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>
); );
}; };