From 6946357a7b79529b7bc6cfa34457a55e7383e204 Mon Sep 17 00:00:00 2001 From: Tomas Dvorak Date: Fri, 9 Oct 2026 05:45:44 +0200 Subject: [PATCH] =?UTF-8?q?fix(mobile):=20gate=20authed=20routes=20behind?= =?UTF-8?q?=20Stack.Protected=20=E2=80=94=20cold-start=20redbox?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit '/' redirected to /(tabs) unconditionally; tab screens call useApi() which throws 'not signed in' during render — before AuthGate's effect redirect could run. Sign-out hit the same throw. - index redirects based on session state (api ? tabs : login) - authed screens wrapped in Stack.Protected guard={!!api} - found by HP-WIN11 emulator visual pass Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- app/mobile/src/app/_layout.tsx | 15 +++++++++------ app/mobile/src/app/index.tsx | 5 ++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/mobile/src/app/_layout.tsx b/app/mobile/src/app/_layout.tsx index a4f5058..53ab67f 100644 --- a/app/mobile/src/app/_layout.tsx +++ b/app/mobile/src/app/_layout.tsx @@ -19,10 +19,11 @@ function AuthGate() { useEffect(() => { if (!ready) return; const inLogin = segments[0] === 'login'; - if (!api && !inLogin) router.replace('/login'); - else if (api && inLogin) router.replace('/'); + if (api && inLogin) router.replace('/'); }, [ready, api, segments, router]); + if (!ready) return null; + return ( + + + + + + - - - - ); } diff --git a/app/mobile/src/app/index.tsx b/app/mobile/src/app/index.tsx index 3861ed0..21eb8bc 100644 --- a/app/mobile/src/app/index.tsx +++ b/app/mobile/src/app/index.tsx @@ -1,5 +1,8 @@ import { Redirect } from 'expo-router'; +import { useSession } from '../session'; export default function Index() { - return ; + const { ready, api } = useSession(); + if (!ready) return null; + return ; }