From 85fd1b238d18ca0e5dd9e4f46c27bc2be0ed35ff Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Sat, 16 Jul 2022 13:26:50 +0300 Subject: [PATCH] Fix user showing logged out when CatchBoundary --- app/components/layout/index.tsx | 4 +++- app/root.tsx | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/components/layout/index.tsx b/app/components/layout/index.tsx index 6567fe501..5524b8ad5 100644 --- a/app/components/layout/index.tsx +++ b/app/components/layout/index.tsx @@ -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({
)}
- + {!isCatchBoundary ? : null} setMenuOpen(!menuOpen)} diff --git a/app/root.tsx b/app/root.tsx index d9d0e08f6..2ba3d3c9d 100644 --- a/app/root.tsx +++ b/app/root.tsx @@ -70,9 +70,11 @@ export const loader: LoaderFunction = async ({ request }) => { function Document({ children, patrons, + isCatchBoundary, }: { children: React.ReactNode; patrons?: RootLoaderData["patrons"]; + isCatchBoundary?: boolean; }) { return ( @@ -83,7 +85,9 @@ function Document({ - {children} + + {children} + @@ -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 ( - + );