move suspense around lazy component (#26333)
Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
parent
f20de396aa
commit
84b2c5eb61
1 changed files with 6 additions and 6 deletions
|
@ -37,11 +37,7 @@ const ContentComponent = () => {
|
||||||
[content, componentId],
|
[content, componentId],
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return modulePath && <Component modulePath={modulePath} />;
|
||||||
<Suspense fallback={<Spinner />}>
|
|
||||||
{modulePath && <Component modulePath={modulePath} />}
|
|
||||||
</Suspense>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type ComponentProps = {
|
type ComponentProps = {
|
||||||
|
@ -52,7 +48,11 @@ const Component = ({ modulePath }: ComponentProps) => {
|
||||||
const Element = lazy(
|
const Element = lazy(
|
||||||
() => import(joinPath(environment.resourceUrl, modulePath)),
|
() => import(joinPath(environment.resourceUrl, modulePath)),
|
||||||
);
|
);
|
||||||
return <Element />;
|
return (
|
||||||
|
<Suspense fallback={<Spinner />}>
|
||||||
|
<Element />
|
||||||
|
</Suspense>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ContentComponent;
|
export default ContentComponent;
|
||||||
|
|
Loading…
Reference in a new issue