sw: tapping a notification clears the whole lchat stack, not just the tapped one
notificationclick now closes all of the app's notifications via getNotifications(), so a single tap dismisses any that piled up instead of leaving the rest lingering in the notification center.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 file changed,
+5
−0
web/static/sw.js+5 −0
diff --git a/web/static/sw.js b/web/static/sw.js| index b738925..24bda82 100644 |
| --- a/web/static/sw.js |
| +++ b/web/static/sw.js |
| @@ -108,6 +108,11 @@ self.addEventListener("notificationclick", (event) => { |
| event.notification.close(); |
| event.waitUntil( |
| (async () => { |
| + // Clear any other lchat notifications too, so a single tap dismisses the |
| + // whole stack rather than leaving the rest lingering in the shade. |
| + try { |
| + for (const n of await self.registration.getNotifications()) n.close(); |
| + } catch {} |
| const wins = await self.clients.matchAll({ type: "window", includeUncontrolled: true }); |
| for (const c of wins) { |
| if ("focus" in c) return c.focus(); |