mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-07-19 17:12:58 -05:00
Fix user showing logged out when CatchBoundary
This commit is contained in:
parent
3bb09a64a3
commit
85fd1b238d
|
|
@ -11,9 +11,11 @@ import type { RootLoaderData } from "~/root";
|
|||
export const Layout = React.memo(function Layout({
|
||||
children,
|
||||
patrons,
|
||||
isCatchBoundary = false,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
patrons?: RootLoaderData["patrons"];
|
||||
isCatchBoundary?: boolean;
|
||||
}) {
|
||||
const location = useLocation();
|
||||
const [menuOpen, setMenuOpen] = React.useState(false);
|
||||
|
|
@ -40,7 +42,7 @@ export const Layout = React.memo(function Layout({
|
|||
<div />
|
||||
)}
|
||||
<div className="layout__header__right-container">
|
||||
<UserItem />
|
||||
{!isCatchBoundary ? <UserItem /> : null}
|
||||
<HamburgerButton
|
||||
expanded={menuOpen}
|
||||
onClick={() => setMenuOpen(!menuOpen)}
|
||||
|
|
|
|||
|
|
@ -70,9 +70,11 @@ export const loader: LoaderFunction = async ({ request }) => {
|
|||
function Document({
|
||||
children,
|
||||
patrons,
|
||||
isCatchBoundary,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
patrons?: RootLoaderData["patrons"];
|
||||
isCatchBoundary?: boolean;
|
||||
}) {
|
||||
return (
|
||||
<html lang="en">
|
||||
|
|
@ -83,7 +85,9 @@ function Document({
|
|||
</head>
|
||||
<body>
|
||||
<React.StrictMode>
|
||||
<Layout patrons={patrons}>{children}</Layout>
|
||||
<Layout patrons={patrons} isCatchBoundary={isCatchBoundary}>
|
||||
{children}
|
||||
</Layout>
|
||||
</React.StrictMode>
|
||||
<ScrollRestoration />
|
||||
<Scripts />
|
||||
|
|
@ -105,10 +109,9 @@ export default function App() {
|
|||
);
|
||||
}
|
||||
|
||||
// TODO: this shows user as logged out even if they are logged in - a bit awkward with 404's
|
||||
export function CatchBoundary() {
|
||||
return (
|
||||
<Document>
|
||||
<Document isCatchBoundary>
|
||||
<Catcher />
|
||||
</Document>
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user