Skip to content

Commit 0dfad75

Browse files
committed
Fix idle status indicator
1 parent b31e1aa commit 0dfad75

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

src/PerfProblemSimulator/wwwroot/js/dashboard.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,15 @@ async function initializeSignalR() {
238238
});
239239

240240
state.connection.onreconnected(async connectionId => {
241-
updateConnectionStatus('connected', 'Connected');
242-
logEvent('system', 'Reconnected to server');
241+
// Preserve idle status on reconnect - don't show "Connected" if app is still idle
242+
// The server will send the current idle state via ReceiveIdleState after connect
243+
if (state.isIdle) {
244+
updateConnectionStatus('idle', 'Idle');
245+
logEvent('system', 'Reconnected to server (still idle)');
246+
} else {
247+
updateConnectionStatus('connected', 'Connected');
248+
logEvent('system', 'Reconnected to server');
249+
}
243250

244251
// NOTE: We do NOT wake the server on reconnect. Only page loads should wake the app.
245252
// This prevents SignalR auto-reconnects (from network hiccups or keepalives) from
@@ -794,6 +801,10 @@ function handleIdleState(data) {
794801
// Going idle
795802
logEvent('idle', data.message || 'Application going idle, no health probes being sent. There will be gaps in diagnostics and logs.');
796803
updateConnectionStatus('idle', 'Idle');
804+
} else if (data.isIdle && wasIdle) {
805+
// Server confirms still idle - ensure status indicator is consistent
806+
// This handles edge cases like reconnects that might have changed the UI status
807+
updateConnectionStatus('idle', 'Idle');
797808
} else if (!data.isIdle && wasIdle) {
798809
// Waking up (client knew we were idle)
799810
logEvent('system', data.message || 'App waking up from idle state. There may be gaps in diagnostics and logs.');

0 commit comments

Comments
 (0)