mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-04-24 19:39:11 +00:00
performance pass on /s/:id route (#183)
* chore(web): attempt a slightly faster unauthed /s/ load * retype RouteWrapper
This commit is contained in:
parent
e0fcfc310e
commit
81b6de7f71
2 changed files with 5 additions and 4 deletions
|
@ -3,9 +3,9 @@ import { GenericLoadingTemplate } from '@roleypoly/design-system/templates/gener
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import AuthLogin from '../pages/auth/login';
|
import AuthLogin from '../pages/auth/login';
|
||||||
import LandingPage from '../pages/landing';
|
import LandingPage from '../pages/landing';
|
||||||
|
import PickerPage from '../pages/picker';
|
||||||
|
|
||||||
const ServersPage = React.lazy(() => import('../pages/servers'));
|
const ServersPage = React.lazy(() => import('../pages/servers'));
|
||||||
const PickerPage = React.lazy(() => import('../pages/picker'));
|
|
||||||
|
|
||||||
const MachineryNewSession = React.lazy(() => import('../pages/machinery/new-session'));
|
const MachineryNewSession = React.lazy(() => import('../pages/machinery/new-session'));
|
||||||
const MachineryLogout = React.lazy(() => import('../pages/machinery/logout'));
|
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 DevToolsSessionDebug = React.lazy(() => import('../pages/dev-tools/session-debug'));
|
||||||
|
|
||||||
const RouteWrapper = (props: {
|
const RouteWrapper = (props: {
|
||||||
component: React.LazyExoticComponent<React.ComponentType<any>>;
|
component: React.ComponentType<any>;
|
||||||
path?: string;
|
path?: string;
|
||||||
default?: boolean;
|
default?: boolean;
|
||||||
}) => (
|
}) => (
|
||||||
|
@ -27,7 +27,7 @@ const RouteWrapper = (props: {
|
||||||
export const AppRouter = () => {
|
export const AppRouter = () => {
|
||||||
return (
|
return (
|
||||||
<Router>
|
<Router>
|
||||||
<LandingPage path="/" />
|
<RouteWrapper component={LandingPage} path="/" />
|
||||||
<RouteWrapper component={ServersPage} path="/servers" />
|
<RouteWrapper component={ServersPage} path="/servers" />
|
||||||
<RouteWrapper component={PickerPage} path="/s/:serverID" />
|
<RouteWrapper component={PickerPage} path="/s/:serverID" />
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ export const AppRouter = () => {
|
||||||
<RouteWrapper component={MachineryLogout} path="/machinery/logout" />
|
<RouteWrapper component={MachineryLogout} path="/machinery/logout" />
|
||||||
<RouteWrapper component={MachineryBotJoin} path="/machinery/bot-join" />
|
<RouteWrapper component={MachineryBotJoin} path="/machinery/bot-join" />
|
||||||
<RouteWrapper component={MachineryBotJoin} path="/machinery/bot-join/:serverID" />
|
<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={DevToolsSetApi} path="/x/dev-tools/set-api" />
|
||||||
<RouteWrapper component={DevToolsSessionDebug} path="/x/dev-tools/session-debug" />
|
<RouteWrapper component={DevToolsSessionDebug} path="/x/dev-tools/session-debug" />
|
||||||
|
|
|
@ -12,6 +12,7 @@ import { makeRoleTransactions } from '../utils/roleTransactions';
|
||||||
|
|
||||||
type PickerProps = {
|
type PickerProps = {
|
||||||
serverID: string;
|
serverID: string;
|
||||||
|
path: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
const Picker = (props: PickerProps) => {
|
const Picker = (props: PickerProps) => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue