Don't stop agent scans when switching agents

When switching between agents in the UI, only stop the UI polling -
don't send a stop command to the agent. Agent scans should continue
running independently. When switching back, checkScanStatus() will
detect the running scan and resume polling.
This commit is contained in:
cemaxecuter
2026-01-31 08:59:30 -05:00
parent bd6fa27970
commit 130a3a2d8e

View File

@@ -1380,9 +1380,19 @@ const WiFiMode = (function() {
console.log('[WiFiMode] Agent changed from', lastAgentId, 'to', currentAgentId);
// Stop any running scan
// Stop UI polling only - don't stop the actual scan on the agent
// The agent should continue running independently
if (isScanning) {
stopScan();
stopAgentDeepScanPolling();
if (pollTimer) {
clearInterval(pollTimer);
pollTimer = null;
}
if (eventSource) {
eventSource.close();
eventSource = null;
}
setScanning(false);
}
// Clear existing data when switching agents (unless "Show All" is enabled)