From fcd2e1bd87eed2ddb267f37d28db84e32b7d7b61 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 6 Mar 2026 23:31:16 -0800 Subject: fix notification click navigate error with uncontrolled clients Co-Authored-By: Claude Opus 4.6 --- src/service-worker.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/service-worker.js b/src/service-worker.js index 89f4cf47..d314f980 100644 --- a/src/service-worker.js +++ b/src/service-worker.js @@ -131,10 +131,12 @@ self.addEventListener("notificationclick", (event) => { const target = new URL(path, self.location.origin).href; event.waitUntil( - clients.matchAll({ type: "window", includeUncontrolled: true }).then((clientList) => { + clients.matchAll({ type: "window" }).then((clientList) => { for (const client of clientList) { - if (new URL(client.url).origin === self.location.origin && "focus" in client) { - client.navigate(target); + if ("navigate" in client) { + return client.navigate(target).then(() => client.focus()); + } + if ("focus" in client) { return client.focus(); } } -- cgit v1.2.3