Skip to content

[Bug]: Report not in sidebar shows "Hmm... it's not here" when opened via direct URL (race between ReportNotFoundGuard and ReportFetchHandler) #92920

Description

@MelvinBot

Summary

A report that is not in the user's sidebar (LHN) can incorrectly show the "Hmm... it's not here" (NOT FOUND) page when opened via a direct URL/deep link in New Expensify — even though the report is fully accessible and the backend returns a valid OpenReport response.

This was diagnosed from a customer report where a specific expense report loaded fine in Expensify Classic but showed "not here" in New Expensify. Chrome DevTools confirmed that no OpenReport API call is made at all — the client decides "not found" purely from Onyx state, with no server request.

Root cause

A race condition introduced when ReportScreen.tsx was decomposed into ReportNotFoundGuard + ReportFetchHandler as separate components. The guard evaluates !isLoading && !reportExists in a render cycle before ReportFetchHandler's useEffect fires openReport. For reports not in the sidebar (loaded via direct URL), this produces a false "not here" page.

The original monolithic ReportScreen had the not-found check and the fetch trigger co-located, which provided implicit ordering guarantees (fetch fired before the guard evaluated). The decomposition broke that coupling.

Problematic flow

  1. User navigates to a report not in their sidebar (via deep link/URL)
  2. OpenApp/ReconnectApp completes → IS_LOADING_REPORT_DATA = false
  3. Report isn't in the OpenApp response (not a sidebar report) → reportExists = false
  4. ReportNotFoundGuard sees !isLoading && !reportExists → shows NOT FOUND
  5. ReportFetchHandler's useEffect either hasn't fired yet, or hits an early return

Key code locations

Impact

Not specific to a single user or report. Any report not in the user's sidebar that is accessed via a direct URL can hit this race. This includes deep links, bookmarks, and shared report links.

Repro

  1. Find a report that is not in the LHN/sidebar (e.g. a submitted/archived expense report on a workspace where you're an admin but the report doesn't surface in the sidebar)
  2. Navigate to it via direct URL in New Expensify (web)
  3. Observe the "Hmm... it's not here" page despite having access. The same report loads fine in Expensify Classic.

Note: opening DevTools before navigating and filtering Network by api.php shows that no OpenReport call is fired.

Platform

Web (Chrome). Likely affects all platforms since the logic is shared client-side code.

Issue OwnerCurrent Issue Owner: @dukenv0307

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions