diff --git a/src/util/updatePageTitle.ts b/src/util/updatePageTitle.ts index ebd8e62e9..37dbf772a 100644 --- a/src/util/updatePageTitle.ts +++ b/src/util/updatePageTitle.ts @@ -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);