Workaround for infinite increment of Dev Tools DOM Nodes counter
This commit is contained in:
parent
6ce9ee58ae
commit
977b0903fa
@ -153,11 +153,11 @@ const Main: FC<StateProps & DispatchProps> = ({
|
|||||||
if (index % 2 === 0) {
|
if (index % 2 === 0) {
|
||||||
const newUnread = selectCountNotMutedUnread(getGlobal()) - initialUnread;
|
const newUnread = selectCountNotMutedUnread(getGlobal()) - initialUnread;
|
||||||
if (newUnread > 0) {
|
if (newUnread > 0) {
|
||||||
document.title = `${newUnread} notification${newUnread > 1 ? 's' : ''}`;
|
updatePageTitle(`${newUnread} notification${newUnread > 1 ? 's' : ''}`);
|
||||||
updateIcon(true);
|
updateIcon(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
document.title = PAGE_TITLE;
|
updatePageTitle(PAGE_TITLE);
|
||||||
updateIcon(false);
|
updateIcon(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,7 +172,7 @@ const Main: FC<StateProps & DispatchProps> = ({
|
|||||||
notificationInterval = undefined;
|
notificationInterval = undefined;
|
||||||
|
|
||||||
if (!document.title.includes(INACTIVE_MARKER)) {
|
if (!document.title.includes(INACTIVE_MARKER)) {
|
||||||
document.title = PAGE_TITLE;
|
updatePageTitle(PAGE_TITLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateIcon(false);
|
updateIcon(false);
|
||||||
@ -216,6 +216,14 @@ function updateIcon(asUnread: boolean) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For some reason setting `document.title` to the same value
|
||||||
|
// causes increment of Chrome Dev Tools > Performance Monitor > DOM Nodes counter
|
||||||
|
function updatePageTitle(nextTitle: string) {
|
||||||
|
if (document.title !== nextTitle) {
|
||||||
|
document.title = nextTitle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default memo(withGlobal(
|
export default memo(withGlobal(
|
||||||
(global): StateProps => {
|
(global): StateProps => {
|
||||||
const { chatId: audioChatId, messageId: audioMessageId } = global.audioPlayer;
|
const { chatId: audioChatId, messageId: audioMessageId } = global.audioPlayer;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user