Skip to content

Commit

Permalink
Merge pull request #29409 from pradeepmdk/fix/1746361833-notiifcation…
Browse files Browse the repository at this point in the history
…-count

update notification count
  • Loading branch information
MariaHCD authored Oct 12, 2023
2 parents 2c9c303 + 2344675 commit f942acd
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
*/
import CONFIG from '../../../CONFIG';

let unreadTotalCount = 0;
/**
* Set the page title on web
*
* @param {Number} totalCount
*/
function updateUnread(totalCount) {
const hasUnread = totalCount !== 0;

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(() => {
Expand All @@ -22,4 +23,8 @@ function updateUnread(totalCount) {
}, 0);
}

window.addEventListener('popstate', () => {
updateUnread(unreadTotalCount);
});

export default updateUnread;

0 comments on commit f942acd

Please sign in to comment.