From ba7d6b7192da59984d6db7845d26cd2c265e4ef8 Mon Sep 17 00:00:00 2001 From: Joseph Burdick Date: Sat, 6 Jan 2024 23:59:34 -0500 Subject: [PATCH] Render null within PrivateRouteBase. Closes #12 --- src/components/PrivateRoute/PrivateRoute.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/PrivateRoute/PrivateRoute.tsx b/src/components/PrivateRoute/PrivateRoute.tsx index 1219852..9aaa4a5 100644 --- a/src/components/PrivateRoute/PrivateRoute.tsx +++ b/src/components/PrivateRoute/PrivateRoute.tsx @@ -5,7 +5,8 @@ import { PrivateRouteBase } from "./PrivateRouteBase"; export const PrivateRoute = async ({ children }: PropsWithChildren) => { const user = await getServerUser(); - if (!user) return null; // Prevent server side render of authorized page + // prevent server side render of authorized page + const view = !user ? null : children; - return {children}; + return {view}; };