Skip to content

Commit ce404b4

Browse files
committed
LAN Speed Test: auto-load the UniFi device list when the console reconnects, no manual Refresh
1 parent d93cd42 commit ce404b4

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

src/NetworkOptimizer.Web/Components/Pages/SpeedTest.razor

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1386,6 +1386,7 @@
13861386
// Discovered devices from UniFi controller (using unified discovery service)
13871387
private List<DiscoveredDevice> discoveredDevices = new();
13881388
private bool loadingDiscovered = false;
1389+
private bool _discoveredDevicesLoaded; // set once the device list has loaded from a connected console; the agent-status poll retries the load when the console reconnects
13891390
13901391
// Saved devices form state
13911392
private bool showAddDevice = false;
@@ -1509,7 +1510,18 @@
15091510
{
15101511
var before = (_siteAgentOffline, _agentRequired);
15111512
await RefreshAgentAvailabilityAsync();
1512-
if (before != (_siteAgentOffline, _agentRequired))
1513+
var changed = before != (_siteAgentOffline, _agentRequired);
1514+
1515+
// The console comes back a moment after the agent tunnel does; once
1516+
// it's connected, load the UniFi device list so it populates without
1517+
// a manual Refresh.
1518+
if (!_discoveredDevicesLoaded && ConnectionService.IsConnected)
1519+
{
1520+
await LoadDiscoveredDevices();
1521+
changed = true;
1522+
}
1523+
1524+
if (changed)
15131525
StateHasChanged();
15141526
});
15151527
}
@@ -2155,6 +2167,7 @@
21552167
.Where(d => d.Type != DeviceType.Gateway && d.CanRunIperf3)
21562168
.OrderBy(d => d.Name)
21572169
.ToList();
2170+
_discoveredDevicesLoaded = true;
21582171
}
21592172
catch (Exception ex)
21602173
{

0 commit comments

Comments
 (0)