fix: resolve Overview page stuck on loading spinner

Agent-Logs-Url: https://github.com/xAlokyx/3x-ui/sessions/6bd8383d-5697-43fe-ba43-fbdc55ca783a

Co-authored-by: xAlokyx <234771438+xAlokyx@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-04-06 12:28:34 +00:00 committed by GitHub
parent d7696a0abf
commit d449b73c10
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -695,7 +695,7 @@
this.logicalPro = data.logicalPro;
this.cpuSpeedMhz = data.cpuSpeedMhz;
this.disk = new CurTotal(data.disk.current, data.disk.total);
this.loads = data.loads.map(load => NumberFormatter.toFixed(load, 2));
this.loads = (data.loads || [0, 0, 0]).map(load => NumberFormatter.toFixed(load, 2));
this.mem = new CurTotal(data.mem.current, data.mem.total);
this.netIO = data.netIO;
this.netTraffic = data.netTraffic;
@ -905,17 +905,19 @@
try {
const msg = await HttpUtil.get('/panel/api/server/status');
if (msg.success) {
if (!this.loadingStates.fetched) {
this.loadingStates.fetched = true;
}
this.setStatus(msg.obj, true);
this.setStatus(msg.obj);
} else if (!this.loadingStates.fetched) {
this.loadingStates.fetched = true;
}
} catch (e) {
console.error("Failed to get status:", e);
if (!this.loadingStates.fetched) {
this.loadingStates.fetched = true;
}
}
},
setStatus(data) {
this.loadingStates.fetched = true;
this.status = new Status(data);
// Push CPU percent into history (clamped 0..100)
const v = Math.max(0, Math.min(100, Number(data?.cpu ?? 0)))