Skip to content

[$250] Web - Document title flickers when navigating away from expense report #86679

@yuwenmemon

Description

@yuwenmemon

Version Number: 9.3.42-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
Email or phone of affected tester (no customers): N/A
Issue reported by: Internal
Bug source: Follow-up from #86141

Action Performed:

  1. Go tonew.expensify.com
  2. Go to a workspace chat
  3. Create two expenses
  4. Open the expense report via Search
  5. Navigate away from the expense report (e.g., click on another page)

Expected Result:

The browser tab title transitions smoothly to the new page's title with no visible flash.

Actual Result:

The browser tab title briefly flickers (flashes blank or shows "New Expensify") before settling on the correct title when navigating away from the expense report.

Root Cause

In src/libs/UnreadIndicatorUpdater/updateUnread/index.ts, updateDocumentTitle() sets document.title = '' before setting the real title as a workaround for a Chrome bug where the title reverts during back navigation:

document.title = '';
document.title = hasUnread ? `(${count}) ${baseTitle}` : baseTitle;

During navigation, multiple triggers fire updateDocumentTitle() (the popstate listener, the navigation state listener debounced at 300ms, and the new screen's setPageTitle() via useFocusEffect). Each schedules its own setTimeout(0) with the document.title = '' → real title sequence, and the browser can render a frame with the blank title between calls, causing the visible flicker.

Possible Solutions

  1. Only clear the title on popstate (actual back navigation), not on every update
  2. Debounce/deduplicate multiple updateDocumentTitle() calls during a single navigation transition
  3. Remove the document.title = '' workaround entirely if the Chrome bug it addresses is no longer relevant in modern Chrome versions

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Context

This was identified during review of #86141 (which added useDocumentTitle to SearchMoneyRequestReportPage). The flicker is a pre-existing issue in updateDocumentTitle() that affects all page transitions, not just the expense report page. Per mananjadhav's review, the overall flicker rate was reduced by #86141 but not fully eliminated.

Issue OwnerCurrent Issue Owner: @mananjadhav
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022038675542395112595
  • Upwork Job ID: 2038675542395112595
  • Last Price Increase: 2026-03-30

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorImprovementItem broken or needs improvement.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions