From c9545cdc3405d0c4b399b960b13b7e83b55a56cc Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Thu, 19 Oct 2023 17:45:27 +0800 Subject: [PATCH] Try focus first, then postMessage --- public/sw.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/sw.js b/public/sw.js index e47c2cdc..03ad471d 100644 --- a/public/sw.js +++ b/public/sw.js @@ -179,12 +179,12 @@ self.addEventListener('notificationclick', (event) => { console.log('NOTIFICATION CLICK navigate', url); if (bestClient) { console.log('NOTIFICATION CLICK postMessage', bestClient); + bestClient.focus(); bestClient.postMessage?.({ type: 'notification', id: tag, accessToken: access_token, }); - bestClient.focus(); } else { console.log('NOTIFICATION CLICK openWindow', url); await self.clients.openWindow(url);