General: Fix page title reset in Chromium (#2580)

This commit is contained in:
Alexander Zinchuk 2023-02-17 02:31:46 +01:00
parent 22083f9638
commit 39feed7b8d

View File

@ -1,7 +1,14 @@
import { debounce } from './schedulers';
const UPDATE_DEBOUNCE_MS = 200;
// For some reason setting `document.title` to the same value
// causes increment of Chrome Dev Tools > Performance Monitor > DOM Nodes counter
export default function updatePageTitle(nextTitle: string) {
function updatePageTitle(nextTitle: string) {
if (document.title !== nextTitle) {
document.title = nextTitle;
}
}
// Synchronous page title update has conflicts with History API in Chrome
export default debounce(updatePageTitle, UPDATE_DEBOUNCE_MS, false);