diff --git a/src/components/Layout/index.tsx b/src/components/Layout/index.tsx index 0eef1dce1..ed4e319f4 100644 --- a/src/components/Layout/index.tsx +++ b/src/components/Layout/index.tsx @@ -73,10 +73,10 @@ const Layout = () => { const shouldShowOnboarding = initState === 'done' && isFirstLaunch && !isInstalling; + // Don't show install screen solely due to waiting-backend when already "done" + // (avoids race where setWaitingBackend() runs after content has rendered) const actualShouldShowInstallScreen = - shouldShowInstallScreen || - initState !== 'done' || - installationState === 'waiting-backend'; + shouldShowInstallScreen || initState !== 'done'; const shouldShowMainContent = !actualShouldShowInstallScreen; if (!chatStore) { diff --git a/src/hooks/useInstallationSetup.ts b/src/hooks/useInstallationSetup.ts index a16f12309..10caf706e 100644 --- a/src/hooks/useInstallationSetup.ts +++ b/src/hooks/useInstallationSetup.ts @@ -153,13 +153,21 @@ export const useInstallationSetup = () => { installationCompleted.current = true; backendReady.current = false; - // Set to waiting-backend state - setWaitingBackend(); + // Only show install screen when not already "done" to avoid layout visibility race + if (initState !== 'done') { + setWaitingBackend(); + } // Start polling for backend startBackendPolling(); } - }, [needsBackendRestart, email, setWaitingBackend, startBackendPolling]); + }, [ + needsBackendRestart, + email, + initState, + setWaitingBackend, + startBackendPolling, + ]); useEffect(() => { if (hasCheckedOnMount.current) { @@ -178,7 +186,10 @@ export const useInstallationSetup = () => { '[useInstallationSetup] Tools already installed, waiting for backend' ); installationCompleted.current = true; - setWaitingBackend(); + // Only show install screen when not already "done" to avoid layout visibility race + if (initState !== 'done') { + setWaitingBackend(); + } // Start polling for backend when tools are already installed startBackendPolling();