From af78ccc8b9c5f8751d1b6bb8aee2fec18e32e85f Mon Sep 17 00:00:00 2001 From: Lucas Berger Date: Thu, 11 Jun 2026 21:14:14 -0400 Subject: [PATCH] fix(quick-260611-tfc): make notificationclick openWindow fallback reachable - Add .then(navigated) check: opens new window when client.navigate() resolves null - Add .catch(): opens new window when client.focus() or client.navigate() rejects - Both branches guarded by self.clients.openWindow per spec - Returned chain (not floating) satisfies no-floating-promises gate - All other behaviour preserved: close(), url extraction, post-loop fallback --- apps/pwa/src/sw.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/pwa/src/sw.ts b/apps/pwa/src/sw.ts index 1bbab90..7820f1e 100644 --- a/apps/pwa/src/sw.ts +++ b/apps/pwa/src/sw.ts @@ -171,7 +171,16 @@ self.addEventListener('notificationclick', (event: NotificationEvent) => { // from the current window location (query string with event uid / date). for (const client of clientList) { if ('focus' in client) { - return client.focus().then(() => client.navigate(url)); + return client + .focus() + .then(() => client.navigate(url)) + .then((navigated) => { + if (navigated === null && self.clients.openWindow) + return self.clients.openWindow(url); + }) + .catch(() => { + if (self.clients.openWindow) return self.clients.openWindow(url); + }); } } // No existing window — open a new one at the deep-link URL