Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/components/Layout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Comment on lines 78 to 80
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bytecii @dataCenter430 I would like to understand why the waiting-backend check was removed here.

This means: as long as the user has previously completed the setup (i.e., initState === 'done' has been persisted), the application proceeds directly to the main UI, regardless of whether the backend has started or is ready.

This can result in chatStore being null and consequently no agent workforce being displayed on the frontend (this bug has already been reported by community members). In addition, sending requests while the backend is not yet ready may also lead to runtime errors.

Furthermore, the issue linked in this PR appears to be largely unrelated to the actual problem this PR is addressing.


if (!chatStore) {
Expand Down
19 changes: 15 additions & 4 deletions src/hooks/useInstallationSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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();
Expand Down