Skip to content

[Due for payment 2026-09-07] Using the global search box on the Spend > Expenses page causes the Amount filter value to be multiplied by 100x. #99071

Closed

Description

@m-natarajan

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.4.57-0
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from BrowserStack:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @RachCHopkins
Slack conversation (hyperlinked to channel name): #Expensify Bugs

Action Performed:

  1. Navigate to Spend > Expenses.
  2. Add an Amount filter using Less than, Greater than, or Equal to.
  3. Enter an amount, for example $500.
  4. Add a keyword to the Global Search box, or reset/clear the search box.
  5. Review the Amount filter value.

Expected Result:

The Amount filter value should remain unchanged when a keyword is added to or removed from the Global Search box.

Actual Result:

The Amount filter value is multiplied by 100x. For example, $500 changes to $50,000.

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

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

Screenshots/Videos

Recording.3391.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @mallenexpensify

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Aug 20, 2026
  2. MelvinBot commented on Aug 20, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    The amount filter value is converted from dollars to cents a second time every time the keyword in the global Search box changes.

    Amounts in a search query are stored in backend cents (e.g. $500 → amount>50000). When you add or clear a keyword, SearchPageInput.submitSearch rebuilds the query and calls getQueryWithUpdatedValues(queryWithContext) without the shouldSkipAmountConversion flag. That flag defaults to false, so getUpdatedFilterValue runs convertToBackendAmount (× 100) on a value that is already in cents: 50000 → 5,000,000, which displays as $50,000. Each keyword add/clear multiplies it by 100 again.

    The sibling SearchRouter component already handles this correctly by threading shouldSkipAmountConversion = true — SearchPageInput is the one caller that forgot to.

    Evidence / data flow
    1. User sets Amount filter to $500 → stored in the URL query as amount>50000 (cents — the correct, first conversion).
    2. User types/clears a keyword → onSubmitEditing / onClearInput both call submitSearch(...) (SearchPageInput.tsx:68-87).
    3. getKeywordQueryWithCurrentSearchContext rebuilds the query string, preserving amount>50000 (cents, no conversion) and appending the keyword.
    4. getQueryWithUpdatedValues is called with shouldSkipAmountConversion defaulting to false.
    5. getUpdatedFilterValue → convertToBackendAmount(50000) = 5,000,000 → query becomes amount>5000000 → filter now shows $50,000.

    Correct pattern for comparison: SearchRouter.submitSearch passes shouldSkipAmountConversion through because its query already holds backend amounts.

    The static twin StaticSearchPageInput.tsx does not call getQueryWithUpdatedValues, so it is not affected — no additional fix needed there.

    What changes do you think we should make in order to solve the problem?

    In SearchPageInput.submitSearch, pass true as the second argument to getQueryWithUpdatedValues, since queryWithContext is derived from the current queryJSON whose amounts are already in backend cents:

    const updatedQuery = getQueryWithUpdatedValues(queryWithContext, true);
    

    This matches how SearchRouter and buildFilterQueryWithSortDefaults re-serialize an already-persisted query, and stops the second × 100 conversion. The global search box only edits the keyword — the amount filter is set elsewhere and stored in cents — so skipping conversion here is safe.

    What alternative solutions did you explore? (Optional)

    None needed — the root cause is a single missing flag, and the correct contract already exists in the codebase.


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/99071) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.


    view run

  3. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Aug 20, 2026
  4. melvin-bot commented on Aug 20, 2026

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @ZhenjaHorbach (External)

  5. melvin-bot commented on Aug 20, 2026

    @melvin-bot
  6. fawad1386 commented on Aug 20, 2026

    @fawad1386

    Proposal

    What is the root cause of that problem?

    Amount filters are stored in two different units. The q query param and the advanced
    filters form both hold backend amounts (cents) — buildAmountFilterQuery writes the form
    value straight into the query — while the text shown in the search box holds frontend
    amounts (dollars), produced by buildUserReadableQueryString.

    When a keyword is typed into the search box, submitSearch in SearchRouter.tsx calls
    getQueryWithUpdatedValues with shouldSkipAmountConversion set to false, because the
    pressed item is the FIND_ITEM row. That runs convertToBackendAmount over the amount
    filter. <<< ONE SENTENCE: why the value reaching that call is already in cents >>>
    The result is a second multiplication by 100, so $500 becomes $50,000.

    What changes do you think we should make in order to solve the problem?

    <<< the minimal fix at the point where the unit is decided, not at the display layer >>>

    The underlying issue is that the unit of an amount filter value is implicit — the same
    string means dollars in one place and cents in another, and correctness depends on every
    call site passing the right shouldSkipAmountConversion flag. A durable fix is to make
    buildUserReadableQueryString not re-apply the frontend conversion to rawFilterList
    values, which are already frontend amounts, so that the search box text has one
    well-defined unit no matter which branch produced it.

    What alternative solutions did you explore? (Optional)

    Clearing rawQuery on this submit path, the way useUpdateFilterQuery, SortByPopup,
    SortOrderPopup and Search/index.tsx already do, also makes the symptom go away. I
    don't think it's the right fix: it adds a fifth workaround for stale rawQuery rather
    than removing the ambiguity, and it would lose the user's typed-in query formatting.

  7. melvin-bot commented on Aug 20, 2026

    @melvin-bot

    📣 @fawad1386! 📣
    Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
    Please follow these steps:

    1. Make sure you've read and understood the contributing guidelines.
    2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
    3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
    4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
      Screen Shot 2022-11-16 at 4 42 54 PM
      Format:
    Contributor details
    Your Expensify account email: <REPLACE EMAIL HERE>
    Upwork Profile Link: <REPLACE LINK HERE>
    
  8. fawad1386 commented on Aug 20, 2026

    @fawad1386

    Contributor details
    Your Expensify account email: mohammad.fawad.564@gmail.com
    Upwork Profile Link: https://www.upwork.com/freelancers/~0117352b6a499bb019

  9. melvin-bot commented on Aug 20, 2026

    @melvin-bot

    ✅ Contributor details stored successfully. Thank you for contributing to Expensify!

  10. ZhenjaHorbach commented on Aug 24, 2026

    @ZhenjaHorbach
    Contributor
  11. MelvinBot commented on Aug 24, 2026

    @MelvinBot
    Contributor

    🤖 Draft PR created: #99313

    Implemented the approved proposal — in SearchPageInput.submitSearch the rebuilt query is derived from queryJSON whose amount filters are already in backend cents, so it now passes shouldSkipAmountConversion = true to getQueryWithUpdatedValues, preventing the second × 100 on every keyword add/clear.

    Checks run locally (all passing):

    • lint-changed
    • react-compiler-compliance-check
    • typecheck (tsgo)
    • SearchQueryUtilsTest (298 tests passed)

    ⚠️ I could not exercise the fix in a running web build: the pre-started test session rendered a blank page (0 accessible nodes) despite a healthy dev server and a successful compile of the changed file. This looks like a session/infra issue rather than anything from the change. The Tests/QA steps and screenshots are left for the human co-author to complete.

    Please mark the PR as "Ready for review" when it is ready.


    view run

  12. melvin-bot commented on Aug 27, 2026

    @melvin-bot

    @ZhenjaHorbach Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  13. 15 remaining items

  14. melvin-bot commented on Sep 4, 2026

    @melvin-bot

    @ZhenjaHorbach Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  15. melvin-bot commented on Sep 4, 2026

    @melvin-bot

    @ZhenjaHorbach Whoops! This issue is 2 days overdue. Let's get this updated quick!

  16. melvin-bot commented on Sep 6, 2026

    @melvin-bot

    Auto-assign attempt failed, all eligible assignees are OOO.

  17. melvin-bot commented on Sep 6, 2026

    @melvin-bot

    Issue is ready for payment but no BZ is assigned. @mallenexpensify you are the lucky winner! Please verify the payment summary looks correct and complete the checklist. Thanks!

  18. melvin-bot commented on Sep 6, 2026

    @melvin-bot

    Payment Summary

    Resolving PRs:

    BugZero Checklist (@mallenexpensify)

    • I have confirmed assignees, roles, and Upwork contracts look correct
    • I have paid out Upwork contracts / manual NewDot requests
    • [BugZero Assignee] I have created a GH issue for creating/updating the regression test once above steps have been agreed upon
  19. ZhenjaHorbach commented on Sep 7, 2026

    @ZhenjaHorbach
    Contributor

    Contributor+ Checklist:

    • [Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

    https://github.com/Expensify/App/pull/93543/changes#r3947862251

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion: NA

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    Regression Test Proposal

    Test:

    1. Open App
    2. Navigate to Spend > Expenses.
    3. Add an Amount filter using Less than, Greater than, or Equal to, and enter an amount, e.g. $500.
    4. Add a keyword to the global Search box, or reset/clear the search box.
    5. Review the Amount filter value.
    6. Verify the Amount filter value stays $500 (it is NOT multiplied by 100 to $50,000).

    Do we agree 👍 or 👎

  20. mallenexpensify commented on Sep 8, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @ZhenjaHorbach due $250 via NewDot

  21. garrettmknight commented on Oct 7, 2026

    @garrettmknight
    Contributor

    $250 approved for @ZhenjaHorbach

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions