Skip to content

[Due for payment 2026-10-23] [$175] Edit multiple hides the Category and Reimbursable rows after Clear cache until each expense detail is opened #101733

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.90-1
Reproducible in staging?: Needs Reproduction (Unable to reproduce)
Reproducible in production?: Needs Reproduction
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: @suneox
Slack conversation (hyperlinked to channel name): #Expensify Bugs

Action Performed:

Preconditions: A workspace with at least 2 draft expenses that have no category

  1. Settings → Troubleshoot → Clear cache and restart.
  2. Go straight to the Search expenses drafts page (do not open any expense first).
  3. Select 2 or more draft expenses → Edit multiple.
  4. Category and Reimbursable rows are missing from the menu.
  5. Open each selected expense's detail → go back, select the same expenses → Edit multiple → both rows are back.

Expected Result:

The Edit multiple menu shows all applicable fields immediately, regardless of whether any expense detail was opened beforehand.

Actual Result:

Both rows are hidden, and no error is shown. They only reappear after opening each selected expense's detail.
Workaround: open each selected expense's detail once before bulk editing.

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

CleanShot.2026-09-21.at.16.16.09.1.1.mp4
CleanShot.2026-09-18.at.16.17.05.1.1.mp4

View all open jobs on GitHub

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

Activity

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

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    The bulk-edit menu decides which rows to show from policy data that the Search flow never loads. On a cold cache that data is absent, so the two rows that require it are silently dropped. Opening each expense fires OpenReport, which hydrates the data — which is why the workaround works.

    SearchEditMultiplePage is registered as an RHP modal screen, so it renders outside SearchScopeProvider. useIsOnSearch() therefore returns the default false, and every useOnyx call on the page reads live Onyx with no snapshot fallback. The page already knows this — it hand-merges snapshot data for transactions, reports and report actions in SearchEditMultipleUtils.ts:130-181, under a comment describing exactly this scenario. It does not do the same for policy data.

    Category — SearchEditMultiplePage.tsx:164 requires hasEnabledOptions(policyCategories ?? {}). policyCategories_ is not in SEARCH_SNAPSHOT_ONYX_KEYS, so it is not in the snapshot, and no screen under src/pages/Search or src/components/Search ever fetches it. The ?? {} collapses "not fetched yet" into "fetched, none enabled", so the row disappears instead of loading.

    Reimbursable — SearchEditMultiplePage.tsx:151 gates on transactionPolicy?.disabledFields?.reimbursable === false. That strict === false demands a fully hydrated policy: a missing policy_<id>, a policy without disabledFields, or an unresolvable report.policyID all evaluate to undefined === false and hide the row. Everywhere else in the repo the same concept is written !== true, which degrades safely — see MoneyRequestView.tsx:536 and useFooterDerivedFlags.ts:97-98. === false appears on exactly two lines in the whole codebase, both on this page.

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

    1. Fetch the policy data on this page. After policyID is derived at line 154, call openPolicyCategoriesPage / openPolicyTagsPage when the policy enables them and the Onyx value is still undefined, re-armed on reconnect. Copy the pattern from MerchantRulePageBase.tsx:234-250 — its comment names this exact failure — or DynamicSplitExpenseEditPage.tsx:140-155, which is an RHP edit page that hit the same gap coming from Search.

    2. Distinguish "not fetched" from "empty". While policyCategories/policyTags are undefined and the user is online, show a loading state instead of a menu with rows missing — the three-branch convention in DynamicIOURequestStepCategory.tsx:161-163.

    3. Relax the Reimbursable gate to !== true, matching the rest of the codebase. Line 143 (Billable) has the same inverted polarity and should change with it.

    What alternative solutions did you explore? (Optional)

    Adding a withSnapshotPolicies helper alongside the existing merge helpers. This does not work on its own: the snapshot's policy record is trimmed (the CategoryPicker deliberately bypasses snapshot policies for that reason), and policyCategories_ is not in the snapshot at all — so the data still has to be fetched.

    Supporting evidence, related gaps, and confidence

    Failure chain

    1. Clear cache → Onyx wiped → OpenApp runs; policyCategories_ is empty.
    2. Search drafts page → snapshot_<hash> written with report_, policy_, transactions_, reportActions_ — no policyCategories_.
    3. Select 2+ → SearchEditMultiplePage mounts in the RHP, outside SearchScopeProvider (default isOnSearch: false, shouldUseSnapshot requires it).
    4. policyCategories → undefined; hasEnabledOptions({}) → false → Category row omitted. transactionPolicy.disabledFields unresolved → Reimbursable row omitted.
    5. Opening each expense fires OpenReport, whose response hydrates the policy and its categories → both rows return.

    The App even documents the snapshot gap inline: "Fetch policy categories directly from Onyx since they are not included in the search snapshot" — TransactionListItem/index.tsx:127.

    Two related gaps worth covering in the same PR

    • The Tag row has identical exposure — policyTags_ is also absent from the snapshot and gates line 165. The reporter likely had no tags enabled.
    • SearchEditMultipleCategoryPage / SearchEditMultipleTagPage don't fetch either, so under the same conditions their pickers render empty.

    Confidence: High on Category — the snapshot key list, the absence of any fetch in Search, and the ?? {} collapse are all conclusive from the code. Medium on Reimbursable — the strict === false provably hides the row whenever policy data is incomplete, but I could not read the backend to confirm which field (policy_<id>.disabledFields vs. an unresolved report.policyID) is the one missing after a cache clear. Both are fixed by the !== true change.

    Reproduction: not attempted in the automated web environment — the pre-provisioned test session was already in an unrecoverable blank state from a failed onboarding replay, so this analysis is static only. A manual check of whether the Billable row behaves the same way in the broken state would narrow the Reimbursable half further.


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


    view run · no recording available

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

    @melvin-bot

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

  5. melvin-bot commented on Sep 21, 2026

    @melvin-bot

    Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.

  6. melvin-bot commented on Sep 24, 2026

    @melvin-bot

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

  7. ashusatyarthi-wq commented on Sep 26, 2026

    @ashusatyarthi-wq
    Contributor details Your Expensify account email: ashu.satyarthi.business@gmail.com Upwork Profile Link: https://www.upwork.com/freelancers/~01b8ab177d61dc225c

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    In Search, after clearing cache and selecting 2 or more draft expenses, opening "Edit multiple" hides the Category and Reimbursable options. They only reappear after opening the details of each selected expense.

    What is the root cause of that problem?

    SearchEditMultiplePage renders in the RHP modal outside SearchScopeProvider (useIsOnSearch() is false), so all useOnyx calls on the page read live Onyx keys without the search snapshot fallback. This creates two distinct root causes:

    1. Missing Category/Tag hydration & pessimistic collapse in SearchEditMultiplePage.tsx:171-172:
      policyCategories_ and policyTags_ are not part of SEARCH_SNAPSHOT_ONYX_KEYS, and no Search screen loads them.
      In SearchEditMultiplePage.tsx:171:

      const areCategoriesEnabled = areSelectedTransactionsExpenses && !!policy?.areCategoriesEnabled && hasEnabledOptions(policyCategories ?? {});

      When cache is cleared, policyCategories is undefined. The fallback ?? {} causes hasEnabledOptions({}) to evaluate to false (collapsing "not yet loaded" to "none enabled"), dropping the Category row. SearchEditMultiplePage also never calls openPolicyCategoriesPage or openPolicyTagsPage to fetch this data. Opening an individual expense runs OpenReport, which hydrates the policy categories/tags and causes the rows to reappear.

    2. Strict === false comparison on unhydrated policy fields (SearchEditMultiplePage.tsx:150, 158):

      return transactionPolicy?.disabledFields?.defaultBillable === false || !!transaction.billable;
      return !isIOUReport(report) && !isInvoiceReport(report) && transactionPolicy?.disabledFields?.reimbursable === false && !isManagedCardTransaction(transaction);

      The strict === false checks require transactionPolicy and its disabledFields to be already fully populated. If transactionPolicy is unhydrated, undefined === false evaluates to false, silently hiding the Reimbursable and Billable rows. Throughout the rest of the codebase (e.g., MoneyRequestView.tsx, useFooterDerivedFlags.ts), disabled fields are checked with !== true to safely default to enabled when data is hydrating.

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

    1. Hydrate missing policy categories and tags in SearchEditMultiplePage.tsx:
      Add a useEffect to fetch categories and tags when the workspace has them enabled and they are not yet in Onyx:

      useEffect(() => {
          if (!policyID) {
              return;
          }
          if (policy?.areCategoriesEnabled && policyCategories === undefined) {
              openPolicyCategoriesPage(policyID);
          }
          if (policy?.areTagsEnabled && policyTags === undefined) {
              openPolicyTagsPage(policyID);
          }
      }, [policyID, policy?.areCategoriesEnabled, policy?.areTagsEnabled, policyCategories, policyTags]);
    2. Do not collapse undefined policy categories/tags to disabled:
      While the data is loading, preserve the options if enabled by the policy:

      const areCategoriesEnabled = areSelectedTransactionsExpenses && !!policy?.areCategoriesEnabled && (policyCategories === undefined || hasEnabledOptions(policyCategories));
      const areTagsEnabled = areSelectedTransactionsExpenses && !!policy?.areTagsEnabled && (policyTags === undefined || hasEnabledTags(policyTagLists));
    3. Align disabledFields checks with codebase standard (!== true):
      In SearchEditMultiplePage.tsx:

      const areSelectedTransactionsBillable = selectedTransactionContexts.every(({transaction, transactionPolicy}) => {
          if (!transaction.reportID || transaction.reportID === CONST.REPORT.UNREPORTED_REPORT_ID) {
              return true;
          }
          return transactionPolicy?.disabledFields?.defaultBillable !== true || !!transaction.billable;
      });
      
      const areSelectedTransactionsReimbursable = selectedTransactionContexts.every(({transaction, report, transactionPolicy}) => {
          if (!transaction.reportID || transaction.reportID === CONST.REPORT.UNREPORTED_REPORT_ID) {
              return true;
          }
          return !isIOUReport(report) && !isInvoiceReport(report) && transactionPolicy?.disabledFields?.reimbursable !== true && !isManagedCardTransaction(transaction);
      });

    What alternative solutions did you explore? (Optional)

    Including policyCategories_ in the Search snapshot was considered, but snapshots are intended to be lightweight summaries for the Search table and avoid bloating storage with entire category trees for all policies. Triggering openPolicyCategoriesPage / openPolicyTagsPage directly on SearchEditMultiplePage when entering bulk edit is lightweight, on-demand, and aligns with other RHP flows (MerchantRulePageBase, DynamicSplitExpenseEditPage).

  8. melvin-bot commented on Sep 28, 2026

    @melvin-bot

    @truph01 Still overdue 6 days?! Let's take care of this!

  9. truph01 commented on Sep 30, 2026

    @truph01
    Contributor

    Melvin's proposal looks good!

    Fetch the policy data on this page. After policyID is derived at line 154, call openPolicyCategoriesPage / openPolicyTagsPage when the policy enables them and the Onyx value is still undefined, re-armed on reconnect. Copy the pattern from MerchantRulePageBase.tsx:234-250 — its comment names this exact failure — or DynamicSplitExpenseEditPage.tsx:140-155, which is an RHP edit page that hit the same gap coming from Search.

    🎀 👀 🎀 C+ reviewed

  10. 25 remaining items

  11. truph01 commented on Oct 20, 2026

    @truph01
    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.

      Link to the comment on the PR:
      Link to the comment on the Issue:

    • [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:

    • [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

    Precondition:

    Test:

    Preconditions: A workspace with at least two draft expenses that have no category.

    1. Go to Settings → Troubleshoot → Clear cache and restart.
    2. Navigate directly to the Search → Drafts page without opening any expenses first.
    3. Select two or more draft expenses and click Edit multiple.
    4. Verify that the Category and Reimbursable rows eventually appear. They may take a few moments to load while waiting for data from the backend.

    Do we agree 👍 or 👎

  12. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Oct 20, 2026
  13. melvin-bot commented on Oct 22, 2026

    @melvin-bot

    Triggered auto assignment to @mallenexpensify (Awaiting Payment)

  14. melvin-bot commented on Oct 22, 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
  15. mallenexpensify commented on Oct 26, 2026

    @mallenexpensify
    Contributor

    Payment Summary

    Contributor+: @truph01 due $175 via NewDot

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 contributorNeeds ReproductionReproducible steps needed

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions