aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-03-06 23:31:16 -0800
committerAdam Soltys <[email protected]>2026-03-06 23:31:16 -0800
commitfcd2e1bd87eed2ddb267f37d28db84e32b7d7b61 (patch)
tree5c055c1e4096fcd85048b202499a530d1ecb33f3
parent6385fc236ead6d156ef2ff2defd7f43586b99177 (diff)
downloadcoinos-ui-fcd2e1bd87eed2ddb267f37d28db84e32b7d7b61.tar.gz
coinos-ui-fcd2e1bd87eed2ddb267f37d28db84e32b7d7b61.zip
fix notification click navigate error with uncontrolled clients
Co-Authored-By: Claude Opus 4.6 <[email protected]>
-rw-r--r--src/service-worker.js8
1 files changed, 5 insertions, 3 deletions
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();
}
}