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:
+10
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user