From c2b9dba9f39c785b813768d26d1da42838b40dc2 Mon Sep 17 00:00:00 2001 From: "Yuwen Memon (via MelvinBot)" Date: Mon, 16 Mar 2026 21:48:05 +0000 Subject: [PATCH] Remove cleanup function from useDocumentTitle to prevent title race condition The cleanup function setPageTitle('') was clearing the browser tab title to an empty string on blur, which caused a race condition with the asynchronous title-update pipeline (setTimeout in updateDocumentTitle and the debounced triggerUnreadUpdate). When navigating back to a previously visited page, the title would revert to "New Expensify" instead of showing the page-specific title. By removing the cleanup, each page simply sets its own title on focus, and the previous title naturally gets overwritten without any gap where the title is empty. Co-authored-by: Yuwen Memon --- src/hooks/useDocumentTitle.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/hooks/useDocumentTitle.ts b/src/hooks/useDocumentTitle.ts index 330b6d0c7bf47..ec40ada435006 100644 --- a/src/hooks/useDocumentTitle.ts +++ b/src/hooks/useDocumentTitle.ts @@ -6,7 +6,6 @@ function useDocumentTitle(title: string) { useFocusEffect( useCallback(() => { setPageTitle(title); - return () => setPageTitle(''); }, [title]), ); }