From 7a30cc4b1254a70d6b2914c085c01746651f8a7f Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Thu, 14 Sep 2023 22:31:16 +0800 Subject: [PATCH] Clear badge when onmount too --- src/components/notification-service.jsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/components/notification-service.jsx b/src/components/notification-service.jsx index f73a1449..c0ff73d4 100644 --- a/src/components/notification-service.jsx +++ b/src/components/notification-service.jsx @@ -106,6 +106,11 @@ export default memo(function NotificationService() { }; }, []); + useLayoutEffect(() => { + if (navigator?.clearAppBadge) { + navigator.clearAppBadge(); + } + }, []); usePageVisibility((visible) => { if (visible && navigator?.clearAppBadge) { console.log('🔰 Clear app badge');