From 0072746c673f679d574753c7261b3213de24ed8b Mon Sep 17 00:00:00 2001 From: Rotimi Best Date: Sat, 28 Mar 2026 11:50:53 +0100 Subject: [PATCH] Fix null checks for user and CIO cookie in event handling - Updated the condition to safely check for the presence of user data in event.locals, preventing potential runtime errors when accessing nested properties. --- apps/dashboard/src/hooks.server.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/dashboard/src/hooks.server.ts b/apps/dashboard/src/hooks.server.ts index a72fff62..96781e82 100644 --- a/apps/dashboard/src/hooks.server.ts +++ b/apps/dashboard/src/hooks.server.ts @@ -32,7 +32,7 @@ const handlePagesRoutes: Handle = async ({ event, resolve }) => { return resolve(event); } - if (!event.locals.user && !hasCioCookie) { + if (!event?.locals?.user && !hasCioCookie) { console.log('no user and no cio cookie, redirecting to login'); const shouldAddRedirectParam = !pathname.includes(ROUTE.LOGOUT); const fullPath = pathname + event.url.search;