Skip to content

[Due for payment 2026-11-25] fix: Search page re-fires a first page that is already refetching #106777

Open

Description

@mountiny

Problem

When the user opens an expense from Spend, or edits it in the RHP, the app sends two Search requests for the same query. A refetch from useSearchAutoRefetch, refreshSearchAfterReportAction or the totals retry marks the snapshot pending, and that reopens the guard in useSearchPageSetup, so the page fires its own request with shouldSaveRecentSearch: true. search() sees that only the new request has the save flag, so it re-sends the whole query after the first one finishes. On large accounts each response blocks the JS thread for seconds, so every edit freezes the app twice.

Solution

useSearchPageSetup now skips its request when the snapshot is loaded, the page already showed this query since the user last came to Search, and a first-page request for the same query is already running. A new isFirstPageSearchInFlight helper in Search.ts checks the totals, footer breakdown and trip-rooms conditions that search() uses to decide on a re-fire, and leaves out the save-flag check that caused the duplicate. When a user arrives on a query that another caller is refreshing, the page still sends the flagged request, so the query still goes into recent searches.

PR

#106685

Issue OwnerCurrent Issue Owner: @brunovjk

Activity

  1. melvin-bot commented on Nov 18, 2026

    @melvin-bot

    @mountiny @TMisiukiewicz

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.5.41-2 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

  2. changed the title [-]fix: Search page re-fires a first page that is already refetching[/-] [+][Due for payment 2026-11-25] fix: Search page re-fires a first page that is already refetching[/+] on Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions