From 88893c5ac5a568c65ffe74dac45311e0e24aae3c Mon Sep 17 00:00:00 2001 From: pradeepkumar Date: Thu, 12 Oct 2023 07:33:23 +0530 Subject: [PATCH 1/3] update notification count --- .../UnreadIndicatorUpdater/updateUnread/index.website.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libs/UnreadIndicatorUpdater/updateUnread/index.website.js b/src/libs/UnreadIndicatorUpdater/updateUnread/index.website.js index 244eaf805d10..d624c02f525f 100644 --- a/src/libs/UnreadIndicatorUpdater/updateUnread/index.website.js +++ b/src/libs/UnreadIndicatorUpdater/updateUnread/index.website.js @@ -3,6 +3,7 @@ */ import CONFIG from '../../../CONFIG'; +let _totalCount = 0; /** * Set the page title on web * @@ -10,7 +11,7 @@ import CONFIG from '../../../CONFIG'; */ function updateUnread(totalCount) { const hasUnread = totalCount !== 0; - + _totalCount = totalCount; // This setTimeout is required because due to how react rendering messes with the DOM, the document title can't be modified synchronously, and we must wait until all JS is done // running before setting the title. setTimeout(() => { @@ -22,4 +23,8 @@ function updateUnread(totalCount) { }, 0); } +window.addEventListener('popstate', (event) => { + updateUnread(_totalCount) + }) + export default updateUnread; From 04c4827d6ad93c427947c4bb197f2a1aa2250320 Mon Sep 17 00:00:00 2001 From: pradeepkumar Date: Thu, 12 Oct 2023 07:41:18 +0530 Subject: [PATCH 2/3] update lint --- .../updateUnread/index.website.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libs/UnreadIndicatorUpdater/updateUnread/index.website.js b/src/libs/UnreadIndicatorUpdater/updateUnread/index.website.js index d624c02f525f..aeb590420c1f 100644 --- a/src/libs/UnreadIndicatorUpdater/updateUnread/index.website.js +++ b/src/libs/UnreadIndicatorUpdater/updateUnread/index.website.js @@ -3,7 +3,7 @@ */ import CONFIG from '../../../CONFIG'; -let _totalCount = 0; +let unReadTotalCount = 0; /** * Set the page title on web * @@ -11,7 +11,7 @@ let _totalCount = 0; */ function updateUnread(totalCount) { const hasUnread = totalCount !== 0; - _totalCount = totalCount; + unReadTotalCount = totalCount; // This setTimeout is required because due to how react rendering messes with the DOM, the document title can't be modified synchronously, and we must wait until all JS is done // running before setting the title. setTimeout(() => { @@ -23,8 +23,8 @@ function updateUnread(totalCount) { }, 0); } -window.addEventListener('popstate', (event) => { - updateUnread(_totalCount) - }) +window.addEventListener('popstate', () => { + updateUnread(unReadTotalCount); +}); export default updateUnread; From 2344675d2c6722c54efc1f3d476a5c06b5f7daf1 Mon Sep 17 00:00:00 2001 From: pradeepkumar Date: Thu, 12 Oct 2023 18:23:58 +0530 Subject: [PATCH 3/3] update property name --- .../UnreadIndicatorUpdater/updateUnread/index.website.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libs/UnreadIndicatorUpdater/updateUnread/index.website.js b/src/libs/UnreadIndicatorUpdater/updateUnread/index.website.js index aeb590420c1f..4c829239ef14 100644 --- a/src/libs/UnreadIndicatorUpdater/updateUnread/index.website.js +++ b/src/libs/UnreadIndicatorUpdater/updateUnread/index.website.js @@ -3,7 +3,7 @@ */ import CONFIG from '../../../CONFIG'; -let unReadTotalCount = 0; +let unreadTotalCount = 0; /** * Set the page title on web * @@ -11,7 +11,7 @@ let unReadTotalCount = 0; */ function updateUnread(totalCount) { const hasUnread = totalCount !== 0; - unReadTotalCount = totalCount; + unreadTotalCount = totalCount; // This setTimeout is required because due to how react rendering messes with the DOM, the document title can't be modified synchronously, and we must wait until all JS is done // running before setting the title. setTimeout(() => { @@ -24,7 +24,7 @@ function updateUnread(totalCount) { } window.addEventListener('popstate', () => { - updateUnread(unReadTotalCount); + updateUnread(unreadTotalCount); }); export default updateUnread;