Skip to content

Fix export options not updating until transactions are reselected - #99684

Draft
MelvinBot wants to merge 2 commits into
mainfrom
claude-exportOptionsLiveSnapshot
Draft

Fix export options not updating until transactions are reselected#99684
MelvinBot wants to merge 2 commits into
mainfrom
claude-exportOptionsLiveSnapshot

Conversation

@MelvinBot

Copy link
Copy Markdown
Contributor

Explanation of Change

The bulk export options in Search were gated on a value frozen into each selection at click time (selectedTransactions[key].isFromOneTransactionReport, captured via isOneTransactionReport(item.report) when the row is toggled). When a row is selected before its report has finished hydrating, report.transactionCount isn't loaded yet, so the frozen flag is false and the wrong/reduced set of export options is produced. Unselecting and reselecting rebuilds the entry from now-loaded data, which is why the workaround made the correct options appear.

This change computes isAllOneTransactionReport from live search-snapshot data at read time instead of the frozen field. For each selected transaction it resolves the report via getReportFromSearchSnapshot(reportID, currentSearchResults?.data, allReports) and tests isOneTransactionReport(...), falling back to the frozen value only when live data isn't available. Both currentSearchResults?.data and allReports are already dependencies of the memo, so the export options recompute as soon as report data lands — no reselect needed. This mirrors the existing canReportBeExported path in the same file, which already reads live snapshot data and self-heals.

The two test mocks were updated to include a faithful getReportFromSearchSnapshot (matching the one already used in useSearchBulkActionsExportTest) now that the export-options path invokes it.

Fixed Issues

$ #98911
PROPOSAL: #98911 (comment)

Tests

  1. Navigate to a Search view containing single-transaction expense reports (e.g. Spend > Card Statements, expand a settlement group).
  2. As soon as the list loads, select one or more eligible transactions (before the underlying report data settles).
  3. Open the Export dropdown.
  4. Verify the correct export options (including report-level export templates) appear the first time, without needing to unselect and reselect.
  5. Unselect and reselect the same transactions and verify the export options remain correct.
  6. Verify that no errors appear in the JS console.
  • Verify that no errors appear in the JS console

Offline tests

Same as Tests.

QA Steps

  1. Navigate to a Search view containing single-transaction expense reports (e.g. Spend > Card Statements, expand a settlement group).
  2. As soon as the list loads, select one or more eligible transactions.
  3. Open the Export dropdown and verify the correct export options appear the first time (no need to unselect/reselect).
  4. Verify that no errors appear in the JS console.
  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

MelvinBot and others added 2 commits August 27, 2026 17:07
Co-authored-by: Joe Ph <gijoe0295@users.noreply.github.com>
Co-authored-by: Joe Ph <gijoe0295@users.noreply.github.com>
@MelvinBot
MelvinBot requested a review from a team August 27, 2026 17:23
@melvin-bot melvin-bot Bot added the Melvin-Test-Web Triggers Melvin to run the testing steps of the PR on web label Aug 27, 2026
@MelvinBot

Copy link
Copy Markdown
Contributor Author

I created this PR from an upstream branch since I don't have push access to your fork.

To take ownership of this branch and be able to push updates, run:

git remote add upstream https://github.com/Expensify/App.git
git fetch upstream claude-exportOptionsLiveSnapshot
git checkout -b claude-exportOptionsLiveSnapshot upstream/claude-exportOptionsLiveSnapshot
git push -u origin claude-exportOptionsLiveSnapshot

Then you can close this PR and open a new one from your fork.

@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Web testing — could not verify the fix (blocked on test data)

Outcome: fail (blocked). The test steps require a Search view containing single-transaction expense reports (e.g. Card Statements → settlement groups). The pinned Melvin web test account is freshly onboarded with no data — no workspaces, no expenses, no reports — so there was nothing selectable in Search to exercise the bulk Export dropdown. VERIFY 1–4 could not be run. Console stayed clean during navigation.

Step Status Observation
1. Navigate to a Search view with single-transaction expense reports; list loads ❌ fail Spend → Expenses shows "No expenses yet"; Reports shows "No reports yet"; Workspaces shows "No workspaces yet" — no data to populate a Search list
2. Select eligible transactions as soon as the list loads ❌ fail No transactions/rows exist to select
3. Export dropdown shows correct options the first time (no reselect) ❌ fail Could not reach; no selectable transactions or report-level export templates exist
4. Unselect + reselect keeps export options correct ❌ fail Could not reach
5. No JS console errors during the flow ✅ pass No error entries during Home → Spend → Expenses/Reports/Workspaces navigation

Why it's blocked: this fix targets single-transaction expense reports surfaced in Search (e.g. company-card settlement groups). Reproducing it needs an account that already has at least one single-transaction expense report — ideally a connected company card feed with settlement groups — visible in Search. That data isn't present in this environment and can't be reasonably hand-seeded here (company card feeds in particular).

To get this verified on Web, re-run against a pre-seeded account/workspace that already has single-transaction expense reports in Search, then repeat steps 1–5.

Evidence (2)

Spend > Expenses view showing 'No expenses yet' empty state

Spend > Expenses view showing 'No expenses yet' empty state

Spend > Reports view showing 'No reports yet' empty state

Spend > Reports view showing 'No reports yet' empty state

view run

@MelvinBot

Copy link
Copy Markdown
Contributor Author

🤖 Android testing — could not verify the fix (blocked on test data)

Outcome: fail (blocked). Same situation as the Web run: the prestarted Melvin Android test account has no workspace membership and no expense/report data, so Search is empty and there was nothing selectable to open the bulk Export dropdown against. VERIFY 1–4 could not be exercised.

Step Status Observation
1. Navigate to a Search view with single-transaction expense reports; list loads ❌ fail Search → Expenses shows "No expenses yet"; Reports shows "No reports yet"; Workspaces shows "No workspaces yet" — account has no data
2. Select eligible transactions as soon as the list loads ❌ fail No transactions exist in any Search view to select
3. Export dropdown shows correct options the first time (no reselect) ❌ fail Not reachable — no selectable transactions/reports
4. Unselect + reselect keeps export options correct ❌ fail Not reachable — no selectable transactions/reports
5. No JS console errors during the flow ⚠️ inconclusive No crash/error banners on-screen, but device log streaming wasn't active during the flow so this couldn't be conclusively confirmed

Why it's blocked: this fix targets single-transaction expense reports surfaced in Search (e.g. company-card settlement groups). Reproducing it needs an account that already has at least one single-transaction expense report — ideally a connected company card feed with settlement groups — visible in Search. That data isn't present in this environment and can't be reasonably hand-seeded here.

To get this verified on Android, re-run against a pre-seeded account/workspace that already has single-transaction expense reports in Search, then repeat steps 1–5.

Evidence (2)

Search screen after typing type:expense query

Search screen after typing type:expense query

Search > Expenses tab showing 'No expenses yet' empty state

Search > Expenses tab showing 'No expenses yet' empty state

view run

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

Labels

Melvin-Test-Android Melvin-Test-Web Triggers Melvin to run the testing steps of the PR on web

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants