refactor(app): simplify session directory with direct snapshots and add sessionReady state
Replace subscription-based session accessor pattern with direct snapshot updates in daemon connections context. Add sessionReady flag to connection state to track when initial agent list has been received. Auto-select first ready host in create agent modal. Migrate from app.json to app.config.js. Add android:release script and Playwright testing docs.
This commit is contained in:
@@ -251,6 +251,18 @@ function AgentFlowModal({
|
||||
}
|
||||
}, [isVisible, initialServerId, selectedServerId]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isVisible || initialServerId || selectedServerId) {
|
||||
return;
|
||||
}
|
||||
const firstReady = daemonEntries.find(
|
||||
({ status, sessionReady }) => status === "online" && sessionReady
|
||||
);
|
||||
if (firstReady) {
|
||||
setSelectedServerId(firstReady.daemon.id);
|
||||
}
|
||||
}, [daemonEntries, initialServerId, isVisible, selectedServerId]);
|
||||
|
||||
const ws = session?.ws ?? null;
|
||||
const inertWebSocket = useMemo<UseWebSocketReturn>(
|
||||
() => ({
|
||||
@@ -339,7 +351,12 @@ function AgentFlowModal({
|
||||
selectedDaemonLastError ? ` ${selectedDaemonLastError}` : ""
|
||||
}`
|
||||
: null;
|
||||
const isTargetDaemonReady = Boolean(hasSelectedDaemon && session && !selectedDaemonIsOffline);
|
||||
const selectedDaemonSessionReady =
|
||||
selectedDaemonConnection?.status === "online" &&
|
||||
selectedDaemonConnection.sessionReady;
|
||||
const isTargetDaemonReady = Boolean(
|
||||
hasSelectedDaemon && selectedDaemonSessionReady && !selectedDaemonIsOffline
|
||||
);
|
||||
|
||||
const [isMounted, setIsMounted] = useState(isVisible);
|
||||
const [workingDir, setWorkingDir] = useState("");
|
||||
|
||||
Reference in New Issue
Block a user