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
This commit is contained in:
Lucas Berger
2026-06-11 21:14:14 -04:00
parent f06216b567
commit af78ccc8b9
+10 -1
View File
@@ -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