Fix export options not updating until transactions are reselected - #99684
Fix export options not updating until transactions are reselected#99684MelvinBot wants to merge 2 commits into
Conversation
Co-authored-by: Joe Ph <gijoe0295@users.noreply.github.com>
Co-authored-by: Joe Ph <gijoe0295@users.noreply.github.com>
|
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: Then you can close this PR and open a new one from your fork. |
|
🤖 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.
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 > Expenses tab showing 'No expenses yet' empty state
|




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 viaisOneTransactionReport(item.report)when the row is toggled). When a row is selected before its report has finished hydrating,report.transactionCountisn't loaded yet, so the frozen flag isfalseand 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
isAllOneTransactionReportfrom live search-snapshot data at read time instead of the frozen field. For each selected transaction it resolves the report viagetReportFromSearchSnapshot(reportID, currentSearchResults?.data, allReports)and testsisOneTransactionReport(...), falling back to the frozen value only when live data isn't available. BothcurrentSearchResults?.dataandallReportsare already dependencies of the memo, so the export options recompute as soon as report data lands — no reselect needed. This mirrors the existingcanReportBeExportedpath 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 inuseSearchBulkActionsExportTest) now that the export-options path invokes it.Fixed Issues
$ #98911
PROPOSAL: #98911 (comment)
Tests
Offline tests
Same as Tests.
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari