Skip to content

Commit 2fe3543

Browse files
committed
Final Stability Fix: Persistent Dashboard Logs and Status Consistency
1 parent 1b66291 commit 2fe3543

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

backend/api_server.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ def get_status():
438438
if not state.server_handler:
439439
return {
440440
"status": "starting" if installing else "not_configured",
441+
"server_id": state.selected_server_id,
441442
"cpu": 0,
442443
"ram": 0,
443444
"players": 0,

electron-app/src/components/Dashboard.jsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,13 @@ export default function Dashboard({ status: serverStatus, onRefresh }) {
288288
}
289289
}, [serverStatus?.status, serverStatus?.shutdown_info, serverStatus?.recent_logs, serverStatus?.tunnel]);
290290

291-
// Reset logs ONLY when the server ID changes (Persist logs after stop)
291+
// Reset logs ONLY when the server ID changes to a DIFFERENT, VALID ID
292292
useEffect(() => {
293-
setLocalLogs([]);
294-
setLocalStatus(serverStatus?.status || 'offline');
293+
if (serverStatus?.server_id && serverStatus.server_id !== selectedServer?.id) {
294+
console.log('[Dashboard] Server ID changed, clearing logs');
295+
setLocalLogs([]);
296+
setLocalStatus(serverStatus?.status || 'offline');
297+
}
295298
}, [serverStatus?.server_id]);
296299

297300

0 commit comments

Comments
 (0)