Skip to content

Commit 664fb2e

Browse files
committed
frontend/sw: fix connection after force refresh
1 parent f89a207 commit 664fb2e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

frontend/src/sw.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,15 @@ function handleWGRequest(event: FetchEvent) {
9898
const event = e as CustomEvent;
9999
resolve(event.detail);
100100
}, {once: true});
101+
102+
// Claim all clients again. This is needed in case a window is forced to refresh
103+
// since they drop out of the service workers clients afterwards.
104+
try {
105+
await self.clients.claim();
106+
} catch (e) {
107+
console.error("Service Worker failed to claim clients:", e);
108+
}
109+
101110
const clients = await self.clients.matchAll();
102111
for (const client of clients) {
103112
client.postMessage(msg);

0 commit comments

Comments
 (0)