Skip to content

Commit

Permalink
move suspense around lazy component (keycloak#26333)
Browse files Browse the repository at this point in the history
Signed-off-by: Erik Jan de Wit <[email protected]>
  • Loading branch information
edewit authored Jan 19, 2024
1 parent f20de39 commit 84b2c5e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions js/apps/account-ui/src/content/ContentComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,7 @@ const ContentComponent = () => {
[content, componentId],
);

return (
<Suspense fallback={<Spinner />}>
{modulePath && <Component modulePath={modulePath} />}
</Suspense>
);
return modulePath && <Component modulePath={modulePath} />;
};

type ComponentProps = {
Expand All @@ -52,7 +48,11 @@ const Component = ({ modulePath }: ComponentProps) => {
const Element = lazy(
() => import(joinPath(environment.resourceUrl, modulePath)),
);
return <Element />;
return (
<Suspense fallback={<Spinner />}>
<Element />
</Suspense>
);
};

export default ContentComponent;

0 comments on commit 84b2c5e

Please sign in to comment.