fix: Catch-all route in development (#11016)

This commit is contained in:
Tom Moor
2025-12-28 10:58:28 -05:00
committed by GitHub
parent 2e1d3f0e65
commit efb3178b82
4 changed files with 74 additions and 84 deletions
+71 -81
View File
@@ -57,91 +57,81 @@ function AuthenticatedRoutes() {
const can = usePolicy(team);
return (
<Switch>
<WebsocketProvider>
<AuthenticatedLayout>
<Suspense
fallback={
<CenteredContent>
<PlaceholderDocument />
</CenteredContent>
}
>
<Switch>
{can.createDocument && (
<Route exact path={draftsPath()} component={Drafts} />
)}
{can.createDocument && (
<Route exact path={archivePath()} component={Archive} />
)}
{can.createDocument && (
<Route exact path={trashPath()} component={Trash} />
)}
<Route path={`${homePath()}/:tab?`} component={Home} />
<Redirect from="/dashboard" to={homePath()} />
<Redirect exact from="/starred" to={homePath()} />
<Redirect
exact
from="/templates"
to={settingsPath("templates")}
/>
<Redirect exact from="/collections/*" to="/collection/*" />
<Route
exact
path={`/collection/${collectionSlug}/new`}
component={DocumentNew}
/>
<Route
exact
path={`/collection/${collectionSlug}/overview/edit`}
component={Collection}
/>
<Route
exact
path={`/collection/${collectionSlug}/:tab?`}
component={Collection}
/>
<Route exact path="/doc/new" component={DocumentNew} />
<Route
exact
path={`/d/${documentSlug}`}
component={RedirectDocument}
/>
<Route
exact
path={`/doc/${documentSlug}/history/:revisionId?`}
component={Document}
/>
<WebsocketProvider>
<AuthenticatedLayout>
<Suspense
fallback={
<CenteredContent>
<PlaceholderDocument />
</CenteredContent>
}
>
<Switch>
{can.createDocument && (
<Route exact path={draftsPath()} component={Drafts} />
)}
{can.createDocument && (
<Route exact path={archivePath()} component={Archive} />
)}
{can.createDocument && (
<Route exact path={trashPath()} component={Trash} />
)}
<Route path={`${homePath()}/:tab?`} component={Home} />
<Redirect from="/dashboard" to={homePath()} />
<Redirect exact from="/starred" to={homePath()} />
<Redirect exact from="/templates" to={settingsPath("templates")} />
<Redirect exact from="/collections/*" to="/collection/*" />
<Route
exact
path={`/collection/${collectionSlug}/new`}
component={DocumentNew}
/>
<Route
exact
path={`/collection/${collectionSlug}/overview/edit`}
component={Collection}
/>
<Route
exact
path={`/collection/${collectionSlug}/:tab?`}
component={Collection}
/>
<Route exact path="/doc/new" component={DocumentNew} />
<Route
exact
path={`/d/${documentSlug}`}
component={RedirectDocument}
/>
<Route
exact
path={`/doc/${documentSlug}/history/:revisionId?`}
component={Document}
/>
<Route
exact
path={`/doc/${documentSlug}/edit`}
component={Document}
/>
<Route path={`/doc/${documentSlug}`} component={Document} />
<Route exact path={`${searchPath()}/:query?`} component={Search} />
{env.isDevelopment && (
<Route exact path={debugPath()} component={Debug} />
)}
{env.isDevelopment && (
<Route
exact
path={`/doc/${documentSlug}/edit`}
component={Document}
path={`${debugPath()}/changesets`}
component={Changesets}
/>
<Route path={`/doc/${documentSlug}`} component={Document} />
<Route
exact
path={`${searchPath()}/:query?`}
component={Search}
/>
{env.isDevelopment && (
<>
<Route exact path={debugPath()} component={Debug} />
<Route
exact
path={`${debugPath()}/changesets`}
component={Changesets}
/>
</>
)}
<Route path="/404" component={Error404} />
<SettingsRoutes />
<Route component={Error404} />
</Switch>
</Suspense>
</AuthenticatedLayout>
</WebsocketProvider>
</Switch>
)}
<Route exact path="/404" component={Error404} />
<SettingsRoutes />
<Route component={Error404} />
</Switch>
</Suspense>
</AuthenticatedLayout>
</WebsocketProvider>
);
}
+1 -1
View File
@@ -15,7 +15,7 @@ const Error403 = () => {
return (
<Scene title={t("No access to this doc")}>
<Heading>{t("No access to this doc")}</Heading>
<VStack spacing={20} style={{ maxWidth: 500 }}>
<VStack spacing={20} style={{ maxWidth: 500 }} align="initial">
<Empty size="large">
{t(
"It doesnt look like you have permission to access this document."
+1 -1
View File
@@ -16,7 +16,7 @@ const Error404 = () => {
return (
<Scene title={t("Not found")}>
<Heading>{t("Not found")}</Heading>
<VStack spacing={20} style={{ maxWidth: 500 }}>
<VStack spacing={20} style={{ maxWidth: 500 }} align="initial">
<Empty size="large">
<Trans>
The page youre looking for cannot be found. It might have been
+1 -1
View File
@@ -15,7 +15,7 @@ const ErrorUnknown = () => {
<CenteredContent>
<PageTitle title={t("Something went wrong")} />
<Heading>{t("Something went wrong")}</Heading>
<VStack spacing={20} style={{ maxWidth: 500 }}>
<VStack spacing={20} style={{ maxWidth: 500 }} align="initial">
<Empty size="large">
<Trans>
Sorry, an unknown error occurred loading the page. Please try again