🐛(frontend) have a suspense fallback
the app crashed on screen changes, I don't quite get why right now… but at least this goes around the issue…
This commit is contained in:
@@ -1,13 +1,15 @@
|
|||||||
import '@livekit/components-styles'
|
import '@livekit/components-styles'
|
||||||
import '@/styles/index.css'
|
import '@/styles/index.css'
|
||||||
|
import { Suspense } from 'react'
|
||||||
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
|
import { ReactQueryDevtools } from '@tanstack/react-query-devtools'
|
||||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import { useLang } from 'hoofd'
|
import { useLang } from 'hoofd'
|
||||||
import { Route, Switch } from 'wouter'
|
import { Route, Switch } from 'wouter'
|
||||||
|
import { Screen } from './layout/Screen'
|
||||||
import { HomeRoute } from '@/features/home'
|
import { HomeRoute } from '@/features/home'
|
||||||
import { NotFound } from './routes/NotFound'
|
|
||||||
import { RoomRoute, roomIdRegex } from '@/features/rooms'
|
import { RoomRoute, roomIdRegex } from '@/features/rooms'
|
||||||
|
import { NotFound } from './routes/NotFound'
|
||||||
import './i18n/init'
|
import './i18n/init'
|
||||||
|
|
||||||
const queryClient = new QueryClient()
|
const queryClient = new QueryClient()
|
||||||
@@ -17,12 +19,14 @@ function App() {
|
|||||||
useLang(i18n.language)
|
useLang(i18n.language)
|
||||||
return (
|
return (
|
||||||
<QueryClientProvider client={queryClient}>
|
<QueryClientProvider client={queryClient}>
|
||||||
<Switch>
|
<Suspense fallback={<Screen />}>
|
||||||
<Route path="/" component={HomeRoute} />
|
<Switch>
|
||||||
<Route path={roomIdRegex} component={RoomRoute} />
|
<Route path="/" component={HomeRoute} />
|
||||||
<Route component={NotFound} />
|
<Route path={roomIdRegex} component={RoomRoute} />
|
||||||
</Switch>
|
<Route component={NotFound} />
|
||||||
<ReactQueryDevtools initialIsOpen={false} />
|
</Switch>
|
||||||
|
<ReactQueryDevtools initialIsOpen={false} />
|
||||||
|
</Suspense>
|
||||||
</QueryClientProvider>
|
</QueryClientProvider>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import type { ReactNode } from 'react'
|
|||||||
import { css } from '@/styled-system/css'
|
import { css } from '@/styled-system/css'
|
||||||
import { Header } from './Header'
|
import { Header } from './Header'
|
||||||
|
|
||||||
export const Screen = ({ children }: { children: ReactNode }) => {
|
export const Screen = ({ children }: { children?: ReactNode }) => {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={css({
|
className={css({
|
||||||
|
|||||||
Reference in New Issue
Block a user