feat: lazy-load popups/modals/chrome (#7313)

* fix: synchronously load first page

* feat: lazy-load popups/modals/chrome
This commit is contained in:
Zach Pomerantz 2023-09-15 12:40:19 -07:00 committed by GitHub
parent 2eb145ab80
commit f47d00be37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 6 deletions

@ -4,9 +4,6 @@ import { getDeviceId, sendAnalyticsEvent, Trace, user } from 'analytics'
import ErrorBoundary from 'components/ErrorBoundary'
import Loader from 'components/Icons/LoadingSpinner'
import NavBar, { PageTabs } from 'components/NavBar'
import Polling from 'components/Polling'
import Popups from 'components/Popups'
import TopLevelModals from 'components/TopLevelModals'
import { useFeatureFlagsIsLoaded } from 'featureFlags'
import { useInfoPoolPageEnabled } from 'featureFlags/flags/infoPoolPage'
import { useAtom } from 'jotai'
@ -32,6 +29,7 @@ import { getCLS, getFCP, getFID, getLCP, Metric } from 'web-vitals'
import Landing from './Landing'
import Swap from './Swap'
const AppChrome = lazy(() => import('./AppChrome'))
const NftExplore = lazy(() => import('nft/pages/explore'))
const Collection = lazy(() => import('nft/pages/collection'))
const Profile = lazy(() => import('nft/pages/profile/profile'))
@ -219,9 +217,9 @@ export default function App() {
<NavBar blur={isHeaderTransparent} />
</HeaderWrapper>
<BodyWrapper>
<Popups />
<Polling />
<TopLevelModals />
<Suspense>
<AppChrome />
</Suspense>
<Suspense fallback={<Loader />}>
{isLoaded ? (
<Routes>

13
src/pages/AppChrome.tsx Normal file

@ -0,0 +1,13 @@
import Polling from 'components/Polling'
import Popups from 'components/Popups'
import TopLevelModals from 'components/TopLevelModals'
export default function AppChrome() {
return (
<>
<Popups />
<Polling />
<TopLevelModals />
</>
)
}