Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

👁️ Add suspense for viewer layout #4624

Merged
merged 4 commits into from
Aug 16, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 37 additions & 24 deletions packages/atlas/src/views/viewer/ViewerLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import styled from '@emotion/styled'
import lazy from '@loadable/component'
import { ErrorBoundary } from '@sentry/react'
import { FC, useEffect, useRef } from 'react'
import { FC, lazy, useEffect, useRef } from 'react'
import { Route, Routes, useLocation, useNavigate, useSearchParams } from 'react-router-dom'
import { CSSTransition, SwitchTransition } from 'react-transition-group'

import { ViewErrorBoundary } from '@/components/ViewErrorFallback'
import { Spinner } from '@/components/_loaders/Spinner'
import { LoadingStudioContainer } from '@/components/_loaders/StudioLoading'
import { BottomNav } from '@/components/_navigation/BottomNav'
import { PrivateRoute } from '@/components/_navigation/PrivateRoute'
import { SidenavViewer } from '@/components/_navigation/SidenavViewer'
Expand Down Expand Up @@ -146,28 +147,40 @@
classNames={transitions.names.fadeAndSlide}
key={displayedLocation.pathname}
>
<Routes location={displayedLocation}>
{viewerRoutes.map((route) => (
<Route key={route.path} {...route} />
))}
<Route
path={relativeRoutes.viewer.memberSettings()}
element={
<PrivateRoute
isAuth={isLoggedIn}
element={<MembershipSettingsView />}
redirectTo={ENTRY_POINT_ROUTE}
/>
}
/>
<Route
path={absoluteRoutes.viewer.notifications()}
element={
<PrivateRoute isAuth={isLoggedIn} element={<NotificationsView />} redirectTo={ENTRY_POINT_ROUTE} />
}
/>
<Route path="*" element={<NotFoundView />} />
</Routes>
<Suspense

Check failure on line 150 in packages/atlas/src/views/viewer/ViewerLayout.tsx

View workflow job for this annotation

GitHub Actions / Tests and Linting (ubuntu-latest, 18.x)

'Suspense' is not defined
fallback={
<LoadingStudioContainer>
<Spinner size="large" />
</LoadingStudioContainer>
}
>
<Routes location={displayedLocation}>
{viewerRoutes.map((route) => (
<Route key={route.path} {...route} />
))}
<Route
path={relativeRoutes.viewer.memberSettings()}
element={
<PrivateRoute
isAuth={isLoggedIn}
element={<MembershipSettingsView />}
redirectTo={ENTRY_POINT_ROUTE}
/>
}
/>
<Route
path={absoluteRoutes.viewer.notifications()}
element={
<PrivateRoute
isAuth={isLoggedIn}
element={<NotificationsView />}
redirectTo={ENTRY_POINT_ROUTE}
/>
}
/>
<Route path="*" element={<NotFoundView />} />
</Routes>
</Suspense>
</CSSTransition>
</SwitchTransition>
</ErrorBoundary>
Expand Down
Loading