mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Unify routers and use lazy for app layouts
This commit is contained in:
parent
735f8b06ce
commit
175b2d6c85
8 changed files with 33 additions and 87 deletions
|
@ -1,4 +1,3 @@
|
|||
import loadable from '@loadable/component';
|
||||
import { History } from '@remix-run/router';
|
||||
import { QueryClientProvider } from '@tanstack/react-query';
|
||||
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
|
||||
|
@ -8,26 +7,17 @@ import { ApiProvider } from 'hooks/useApi';
|
|||
import { WebConfigProvider } from 'hooks/useWebConfig';
|
||||
import { queryClient } from 'utils/query/queryClient';
|
||||
|
||||
const StableAppRouter = loadable(() => import('./apps/stable/AppRouter'));
|
||||
const RootAppRouter = loadable(() => import('./RootAppRouter'));
|
||||
import RootAppRouter from 'RootAppRouter';
|
||||
|
||||
const RootApp = ({ history }: Readonly<{ history: History }>) => {
|
||||
const layoutMode = localStorage.getItem('layout');
|
||||
const isExperimentalLayout = layoutMode === 'experimental';
|
||||
|
||||
return (
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<ApiProvider>
|
||||
<WebConfigProvider>
|
||||
{isExperimentalLayout ?
|
||||
<RootAppRouter history={history} /> :
|
||||
<StableAppRouter history={history} />
|
||||
}
|
||||
</WebConfigProvider>
|
||||
</ApiProvider>
|
||||
<ReactQueryDevtools initialIsOpen={false} />
|
||||
</QueryClientProvider>
|
||||
);
|
||||
};
|
||||
const RootApp = ({ history }: Readonly<{ history: History }>) => (
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<ApiProvider>
|
||||
<WebConfigProvider>
|
||||
<RootAppRouter history={history} />
|
||||
</WebConfigProvider>
|
||||
</ApiProvider>
|
||||
<ReactQueryDevtools initialIsOpen={false} />
|
||||
</QueryClientProvider>
|
||||
);
|
||||
|
||||
export default RootApp;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue