mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
Fix create agent modal incorrectly showing hosts as offline
The availability check was failing for online hosts due to a timing issue: connectionStates would show "online" before SessionProvider registered its session accessor, causing session to be null. Changed selectedDaemonIsUnavailable to selectedDaemonIsOffline which only checks connectionStates status (the single source of truth for connection state), removing the redundant session and ws.isConnected checks. isTargetDaemonReady still requires session for actual operations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -330,17 +330,16 @@ function AgentFlowModal({
|
||||
"Selected host";
|
||||
const selectedDaemonStatusLabel = formatConnectionStatus(selectedDaemonStatus);
|
||||
const hasSelectedDaemon = Boolean(selectedServerId);
|
||||
const selectedDaemonIsUnavailable =
|
||||
!session || selectedDaemonStatus !== "online" || !ws?.isConnected;
|
||||
const selectedDaemonIsOffline = selectedDaemonStatus !== "online";
|
||||
const selectedDaemonLastError = selectedDaemonConnection?.lastError?.trim();
|
||||
const daemonAvailabilityError = !hasSelectedDaemon
|
||||
? "Select a host before creating or importing agents."
|
||||
: selectedDaemonIsUnavailable
|
||||
: selectedDaemonIsOffline
|
||||
? `${selectedDaemonLabel} is ${selectedDaemonStatusLabel}. We'll reconnect automatically and enable actions once it's online.${
|
||||
selectedDaemonLastError ? ` ${selectedDaemonLastError}` : ""
|
||||
}`
|
||||
: null;
|
||||
const isTargetDaemonReady = Boolean(hasSelectedDaemon && session && !selectedDaemonIsUnavailable);
|
||||
const isTargetDaemonReady = Boolean(hasSelectedDaemon && session && !selectedDaemonIsOffline);
|
||||
|
||||
const [isMounted, setIsMounted] = useState(isVisible);
|
||||
const [workingDir, setWorkingDir] = useState("");
|
||||
|
||||
Reference in New Issue
Block a user