mirror of
https://github.com/vercel/commerce.git
synced 2025-05-15 14:06:59 +00:00
Add supense to Dynamic contentg
This commit is contained in:
parent
e566c1f451
commit
06e87a448d
@ -7,6 +7,7 @@ import ReusableSection from '@/components/modules/reusable-section/reusable-sect
|
|||||||
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 { InfoCircledIcon } from '@radix-ui/react-icons';
|
||||||
|
import { Suspense } from 'react';
|
||||||
interface getContentComponentProps {
|
interface getContentComponentProps {
|
||||||
_type: string;
|
_type: string;
|
||||||
_key: number;
|
_key: number;
|
||||||
@ -76,7 +77,9 @@ const getContentComponent = ({ _type, _key, disabled, ...rest }: getContentCompo
|
|||||||
}
|
}
|
||||||
|
|
||||||
return Component ? (
|
return Component ? (
|
||||||
<Component key={`${_key}`} {...rest} />
|
<Suspense key={`${_key}`} fallback={<div>Loading...</div>}>
|
||||||
|
<Component {...rest} />
|
||||||
|
</Suspense>
|
||||||
) : (
|
) : (
|
||||||
<div key={`${_key}`}>Something else</div>
|
<div key={`${_key}`}>Something else</div>
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user