Fix 404 page showing you as logged out

This commit is contained in:
Kalle
2026-10-03 19:57:22 +03:00
parent 0bece62f30
commit 2d7ea2632d
2 changed files with 22 additions and 2 deletions

View File

@@ -20,6 +20,7 @@ import {
useNavigate,
useNavigation,
useRevalidator,
useRouteLoaderData,
useSearchParams,
} from "react-router";
import { Config } from "~/config";
@@ -440,9 +441,24 @@ export default function App() {
}
export function ErrorBoundary() {
const rootData = useRouteLoaderData<RootLoaderData>("root");
if (!rootData) {
return (
<ThemeProvider themeSource="static" specifiedTheme={Theme.DARK}>
<Document>
<Catcher />
</Document>
</ThemeProvider>
);
}
return (
<ThemeProvider themeSource="static" specifiedTheme={Theme.DARK}>
<Document>
<ThemeProvider
specifiedTheme={isTheme(rootData.theme) ? rootData.theme : null}
themeSource="user-preference"
>
<Document data={rootData}>
<Catcher />
</Document>
</ThemeProvider>

View File

@@ -0,0 +1,4 @@
---
type: bug
---
Error pages such as "Page not found" no longer show you as logged out