router: lazy loading needs a suspense tag
According to the React documentation[0], a suspense tag is needed to encapsulate a lazy loaded component. Some bad behavior have been fix in the UI thanks to that tag (i.e notification popup unclosable after wizard creation). [0] https://react.dev/reference/react/lazy#suspense-for-code-splitting
This commit is contained in:
parent
d66b013f5b
commit
178791f2ad
1 changed files with 17 additions and 3 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import React, { lazy } from 'react';
|
||||
import React, { lazy, Suspense } from 'react';
|
||||
|
||||
import { useFlag } from '@unleash/proxy-client-react';
|
||||
import { Route, Routes } from 'react-router-dom';
|
||||
|
|
@ -16,8 +16,22 @@ export const Router = () => {
|
|||
const edgeParityFlag = useFlag('edgeParity.image-list');
|
||||
return (
|
||||
<Routes>
|
||||
<Route path="*" element={<LandingPage />}>
|
||||
<Route path="imagewizard/:composeId?" element={<CreateImageWizard />} />
|
||||
<Route
|
||||
path="*"
|
||||
element={
|
||||
<Suspense>
|
||||
<LandingPage />
|
||||
</Suspense>
|
||||
}
|
||||
>
|
||||
<Route
|
||||
path="imagewizard/:composeId?"
|
||||
element={
|
||||
<Suspense>
|
||||
<CreateImageWizard />
|
||||
</Suspense>
|
||||
}
|
||||
/>
|
||||
<Route path="share/:composeId" element={<ShareImageModal />} />
|
||||
</Route>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue