Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix(ui): keep AuthGuard from re-running on every route change
cyhe17b0080f8b6
diff --git a/ui/src/App.tsx b/ui/src/App.tsxindex 6063e7913..63703fc14 100644--- a/ui/src/App.tsx+++ b/ui/src/App.tsx@@ -44,15 +44,19 @@ const RemoteLoginRedirect = ({ target }: { target: string }) => {type GuardStatus = 'loading' | 'ready' | 'needs-setup' | 'remote-login-required';-// Wrapper to check if setup is needed+// Wrapper to check if setup is needed.+//+// Validation is global (auth session + setup state), so we only run it+// once per mount (plus when ``bypassSetupGuard`` flips for the logs /+// diagnostics escape hatches). Earlier versions re-ran on every URL+// change and reset the layout to a "Loading..." div while the two API+// calls round-tripped — that made every sidebar click feel like a full+// page reload because ``<AppShell>`` got unmounted and re-mounted.const AuthGuard = ({ children }: { children: ReactNode }) => {const { getConfig, getAuthSession } = useApi();const location = useLocation();const guardTarget = location.pathname + location.search;- const [guardState, setGuardState] = useState<{ target: string; status: GuardStatus }>({- target: '',- status: 'loading',- });+ const [guardStatus, setGuardStatus] = useState<GuardStatus>('loading');const bypassSetupGuard = LOGIN_CHECK_PATHS.has(location.pathname);useEffect(() => {@@ -65,7 +69,7 @@ const AuthGuard = ({ children }: { children: ReactNode }) => {getAuthSession().then(session => {if (cancelled) return;if (session.remote && !session.authenticated) {- setGuardState({ target: guardTarget, status: 'remote-login-required' });+ setGuardStatus('remote-login-required');return null;}return getConfig().then(config => {@@ -74,38 +78,38 @@ const AuthGuard = ({ children }: { children: ReactNode }) => {const setupReady = typeof setupState?.needs_setup === 'boolean'? setupState.needs_setup === false: hasConfiguredPlatformCredentials(config);- setGuardState({- target: guardTarget,- status: !config || !config.mode || !setupReady ? 'needs-setup' : 'ready',- });+ setGuardStatus(!config || !config.mode || !setupReady ? 'needs-setup' : 'ready');});}).catch(async (error) => {if (cancelled) return;const session = await getAuthSession().catch(() => null);if (cancelled) return;if (session?.remote && !session.authenticated) {- setGuardState({ target: guardTarget, status: 'remote-login-required' });+ setGuardStatus('remote-login-required');return;}console.error('[AuthGuard] setup check failed', error);// If fetch fails for local/non-remote use (e.g. config doesn't exist),// setup is needed. Remote 401s are handled by the session branch above.- setGuardState({ target: guardTarget, status: 'needs-setup' });+ setGuardStatus('needs-setup');});return () => {cancelled = true;};- }, [bypassSetupGuard, getConfig, getAuthSession, guardTarget]);+ // Intentionally excludes ``guardTarget`` — we don't want every+ // route change to re-validate (which would also re-mount the+ // shell behind the Loading state).+ }, [bypassSetupGuard, getConfig, getAuthSession]);if (bypassSetupGuard) return children;- if (guardState.target !== guardTarget || guardState.status === 'loading') {+ if (guardStatus === 'loading') {return <div className="min-h-screen flex items-center justify-center bg-bg text-text">Loading...</div>;}- if (guardState.status === 'remote-login-required') {+ if (guardStatus === 'remote-login-required') {return <RemoteLoginRedirect target={guardTarget} />;}- if (guardState.status === 'needs-setup') {+ if (guardStatus === 'needs-setup') {if (location.pathname === '/setup') return children;return <Navigate to="/setup" replace />;}