mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
prevent flicker when refreshing
This commit is contained in:
@@ -84,7 +84,6 @@ const SystemStatus = () => {
|
|||||||
send: loadData,
|
send: loadData,
|
||||||
error
|
error
|
||||||
} = useRequest(readSystemStatus, {
|
} = useRequest(readSystemStatus, {
|
||||||
initialData: [],
|
|
||||||
async middleware(_, next) {
|
async middleware(_, next) {
|
||||||
if (!restarting) {
|
if (!restarting) {
|
||||||
await next();
|
await next();
|
||||||
|
|||||||
@@ -4353,13 +4353,19 @@ router
|
|||||||
// SYSTEM and SETTINGS
|
// SYSTEM and SETTINGS
|
||||||
router
|
router
|
||||||
.get(ACTIVITY_ENDPOINT, () => activity)
|
.get(ACTIVITY_ENDPOINT, () => activity)
|
||||||
.get(SYSTEM_STATUS_ENDPOINT, () => {
|
.get(SYSTEM_STATUS_ENDPOINT, async () => {
|
||||||
if (countHardwarePoll >= 2) {
|
if (countHardwarePoll >= 2) {
|
||||||
countHardwarePoll = 0;
|
countHardwarePoll = 0;
|
||||||
system_status.status = 0; // SYSTEM_STATUS_NORMAL
|
system_status.status = 0; // SYSTEM_STATUS_NORMAL
|
||||||
}
|
}
|
||||||
countHardwarePoll++;
|
countHardwarePoll++;
|
||||||
|
|
||||||
|
// Add a small artificial delay to better simulate a real network, to see if flash is fixed
|
||||||
|
// await new Promise((resolve) => setTimeout(resolve, 3000));
|
||||||
|
|
||||||
|
system_status.uptime += 3; // simulate 3 seconds of uptime
|
||||||
|
system_status.bus_uptime += 3;
|
||||||
|
|
||||||
return system_status;
|
return system_status;
|
||||||
})
|
})
|
||||||
.get(SECURITY_SETTINGS_ENDPOINT, () => security_settings)
|
.get(SECURITY_SETTINGS_ENDPOINT, () => security_settings)
|
||||||
|
|||||||
Reference in New Issue
Block a user