From 39feed7b8d69ef4fa3c63cba5d8364525b983a7d Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Fri, 17 Feb 2023 02:31:46 +0100 Subject: [PATCH] General: Fix page title reset in Chromium (#2580) --- src/util/updatePageTitle.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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);