performance pass on /s/:id route (#183)

* chore(web): attempt a slightly faster unauthed /s/ load

* retype RouteWrapper
This commit is contained in:
41666 2021-03-15 20:22:18 -04:00 committed by GitHub
parent e0fcfc310e
commit 81b6de7f71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 4 deletions

View file

@ -3,9 +3,9 @@ import { GenericLoadingTemplate } from '@roleypoly/design-system/templates/gener
import * as React from 'react';
import AuthLogin from '../pages/auth/login';
import LandingPage from '../pages/landing';
import PickerPage from '../pages/picker';
const ServersPage = React.lazy(() => import('../pages/servers'));
const PickerPage = React.lazy(() => import('../pages/picker'));
const MachineryNewSession = React.lazy(() => import('../pages/machinery/new-session'));
const MachineryLogout = React.lazy(() => import('../pages/machinery/logout'));
@ -15,7 +15,7 @@ const DevToolsSetApi = React.lazy(() => import('../pages/dev-tools/set-api'));
const DevToolsSessionDebug = React.lazy(() => import('../pages/dev-tools/session-debug'));
const RouteWrapper = (props: {
component: React.LazyExoticComponent<React.ComponentType<any>>;
component: React.ComponentType<any>;
path?: string;
default?: boolean;
}) => (
@ -27,7 +27,7 @@ const RouteWrapper = (props: {
export const AppRouter = () => {
return (
<Router>
<LandingPage path="/" />
<RouteWrapper component={LandingPage} path="/" />
<RouteWrapper component={ServersPage} path="/servers" />
<RouteWrapper component={PickerPage} path="/s/:serverID" />
@ -38,7 +38,7 @@ export const AppRouter = () => {
<RouteWrapper component={MachineryLogout} path="/machinery/logout" />
<RouteWrapper component={MachineryBotJoin} path="/machinery/bot-join" />
<RouteWrapper component={MachineryBotJoin} path="/machinery/bot-join/:serverID" />
<AuthLogin path="/auth/login" />
<RouteWrapper component={AuthLogin} path="/auth/login" />
<RouteWrapper component={DevToolsSetApi} path="/x/dev-tools/set-api" />
<RouteWrapper component={DevToolsSessionDebug} path="/x/dev-tools/session-debug" />

View file

@ -12,6 +12,7 @@ import { makeRoleTransactions } from '../utils/roleTransactions';
type PickerProps = {
serverID: string;
path: string;
};
const Picker = (props: PickerProps) => {