Skip to content

[Due for payment 2026-05-18] perf: WorkspacesTabButton re-renders on every navigation action due to broad navigation state subscription #89911

@mountiny

Description

@mountiny

Problem

useRestoreWorkspacesTabOnNavigate subscribes to the entire navigation state via useOnyx(ONYXKEYS.NAVIGATION_STATE), causing WorkspacesTabButton to re-render on every navigation action — regardless of whether the active workspace actually changed.

Since WorkspacesTabButton lives in the global tab bar, this affects all navigation actions across the app and is especially costly for accounts with large numbers of policies (e.g. 5k+ policies).

Impact

Measured on a large account with 5k policies:

  • Web: no visible improvement
  • Mobile (ManualOpenReport of money request): 882ms → 713ms (19% faster)

This regression affects all navigation actions in the app, not just opening reports.

Root Cause

The useOnyx(ONYXKEYS.NAVIGATION_STATE) subscription in useRestoreWorkspacesTabOnNavigate triggers a re-render of WorkspacesTabButton on every navigation event, even when the workspace-related slice of state hasn't changed. A targeted selector should be used so re-renders only fire when the relevant part of the state actually changes.

Expected Behavior

WorkspacesTabButton should only re-render when the active workspace changes, not on every navigation action.

Related

Issue OwnerCurrent Issue Owner: @mallenexpensify

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionDailyKSv2Task

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions