From 8cf30773ce8b3b4160f01a6caa807cc049f2bec3 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Sun, 15 Oct 2023 16:25:04 +0800 Subject: [PATCH] Close notification early Not sure if this would make a difference but possibly fix some bugs --- public/sw.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/sw.js b/public/sw.js index e47c2cdc..fe6d0fe6 100644 --- a/public/sw.js +++ b/public/sw.js @@ -163,6 +163,7 @@ self.addEventListener('notificationclick', (event) => { const { access_token, notification_type } = data; const url = `/#/notifications?id=${tag}&access_token=${btoa(access_token)}`; + event.notification.close(); event.waitUntil( (async () => { const clients = await self.clients.matchAll({ @@ -194,7 +195,6 @@ self.addEventListener('notificationclick', (event) => { console.log('NOTIFICATION CLICK openWindow', url); await self.clients.openWindow(url); } - await event.notification.close(); })(), ); });