fix: recover PWA after backgrounding

This commit is contained in:
Miguel Palhas
2026-09-06 18:02:11 +01:00
parent be554d0ede
commit 0c46fb993a
5 changed files with 81 additions and 0 deletions
+11
View File
@@ -148,6 +148,17 @@ export class DaemonLink {
void this.probe();
}
/**
* Recheck liveness after the browser resumes from the background. Mobile
* browsers may suspend both WebSocket events and timers while a PWA is
* hidden, leaving a stale `down` state after the daemon is already back.
*/
recover(): void {
if (this.state === "updating") return;
this.noteDisconnected();
void this.probe();
}
/**
* One `/api/info` round-trip. Resolves `true` when the daemon answered.
*