Add bulk export to accounting integration#81421
Conversation
|
Hey, I noticed you changed If you want to automatically generate translations for other locales, an Expensify employee will have to:
Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running: npx ts-node ./scripts/generateTranslations.ts --helpTypically, you'd want to translate only what you changed by running |
|
@ahmedGaber93 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
…rt-accounting-integrations
| const successActions: Record<string, OptimisticExportIntegrationAction> = {}; | ||
| const optimisticReportActions: Record<string, string> = {}; | ||
|
|
||
| for (const reportID of reportIDs) { |
There was a problem hiding this comment.
❌ PERF-13 (docs)
The function buildOptimisticExportIntegrationAction(connectionName) is called inside the for loop but does not use the iterator variable reportID. This results in redundant computation - the function produces the same result for each iteration based only on connectionName, which is constant throughout the loop.
Hoist the function call outside the loop to eliminate O(n) redundant computations:
function exportMultipleReportsToIntegration(hash: number, reportIDs: string[], connectionName: ConnectionName, currentSearchKey?: SearchKey) {
if (!reportIDs.length) {
return;
}
const baseOptimisticAction = buildOptimisticExportIntegrationAction(connectionName);
const optimisticActions: Record<string, OptimisticExportIntegrationAction> = {};
const successActions: Record<string, OptimisticExportIntegrationAction> = {};
const optimisticReportActions: Record<string, string> = {};
for (const reportID of reportIDs) {
const optimisticAction = {...baseOptimisticAction, reportActionID: baseOptimisticAction.reportActionID + reportID}; // Ensure unique IDs
const successAction: OptimisticExportIntegrationAction = {...optimisticAction, pendingAction: null};
const optimisticReportActionID = optimisticAction.reportActionID;
optimisticActions[reportID] = optimisticAction;
successActions[reportID] = successAction;
optimisticReportActions[reportID] = optimisticReportActionID;
}
// ... rest of function
}Note: If buildOptimisticExportIntegrationAction generates unique IDs internally, you may need to adjust the implementation to ensure uniqueness while avoiding redundant computation.
Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
src/pages/Search/SearchPage.tsx
Outdated
| return reportExportOptions.includes(CONST.REPORT.EXPORT_OPTIONS.EXPORT_TO_INTEGRATION); | ||
| }; | ||
|
|
||
| // Check if all selected reports can be exported using existing logic |
There was a problem hiding this comment.
❌ PERF-2 (docs)
The expensive operation selectedReports.every(canReportBeExported) runs before checking the simple condition connectedIntegration. The canReportBeExported function calls multiple expensive operations (getReportOrDraftReport, getSecondaryExportReportActions) for each report.
Since connectedIntegration is already computed earlier in the function, we can check it BEFORE running the expensive .every() operation. If connectedIntegration is falsy, the result of canExportAllReports won't be used anyway (see the if (canExportAllReports && connectedIntegration) check below).
Move the connectedIntegration check earlier to avoid unnecessary computation:
// Check if all selected reports can be exported using existing logic
const canExportAllReports = connectedIntegration && isReportsTab && selectedReportIDs.length > 0 && includeReportLevelExport && selectedReports.every(canReportBeExported);This way, if there's no connected integration, the expensive .every() operation is skipped entirely.
Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f84ffac689
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
src/pages/Search/SearchPage.tsx
Outdated
| onSelected: () => { | ||
| // Show accounting integration confirmation modal | ||
| setAccountingExportModalVisible(true); | ||
| exportMultipleReportsToIntegration(hash, selectedReportIDs, connectedIntegration); |
There was a problem hiding this comment.
Pass currentSearchKey to update export search results
When users bulk-export from the Export suggested search, exportMultipleReportsToIntegration only removes exported reports from the snapshot if currentSearchKey === EXPORT (see src/libs/actions/Search.ts around the currentSearchKey check). This call doesn’t pass a search key, so in the Export search view the items will stay visible after a successful export and can be re‑exported unintentionally. Consider passing the current search key (or otherwise updating the snapshot) so the UI reflects the successful export.
Useful? React with 👍 / 👎.
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
joekaufmanexpensify
left a comment
There was a problem hiding this comment.
Good from product
…rt-accounting-integrations
…rt-accounting-integrations
…rt-accounting-integrations
Screen.Recording.2026-02-06.at.08.32.23.mov@trjExpensify Do we keep the same behavior as the old Dot? I mean, we show a processing modal during export, and if the export fails, we show an alert modal, like in the old Dot. Screen.Recording.2026-02-06.at.08.39.53.movBy the way, when we mark it as exported, do we show a success toast like in the old Dot? |
|
@trjExpensify If we’re going to follow the same behavior as the old Dot, could you please add the design flow so I can follow it and update accordingly? |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppa.mp4Android: mWeb Chromeaw.mp4iOS: HybridAppi.mp4iOS: mWeb Safariiw.mp4MacOS: Chrome / Safariw.mp4 |
|
Bug: “Already exported” confirmation alert does not appear when trying to export an already exported report. Bug: Console warning appears after exporting: Bug: Selected items are not unselected after the export action is completed. Video for the 3 bugs above20260207212708284.mp4Bug: Export to integration action is not shown for paid reports until the report is opened and loaded. Steps
Video20260207213409019.mp4 |
…rt-accounting-integrations
|
I'm not sure I'm following those comments, @huult. We talked about that topic in the parent issue from here if you recall. That said, @Expensify/design, @puneetlath, @JmillsExpensify, given our recent discussion on the CSV export alert modal, do we want to revisit this direction? UI wise, I think it would boil down to:
For clarity though... what I meant by this comment above in the PR @huult was simply that this issue was created to facilitate bulk export to accounting. In your tests and evidence, please show bulk exporting reports to validate it works, not just exporting one report at a time. |
…rt-accounting-integrations
|
@arosiclair done |
…rt-accounting-integrations
arosiclair
left a comment
There was a problem hiding this comment.
Thanks this LGTM. @ahmedGaber93 can you retest? We changed things a bit since you last tested.
|
@huult Could you please resolve the merge conflicts? |
…rt-accounting-integrations
|
@ahmedGaber93 Done! |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 @arosiclair has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/arosiclair in version: 9.3.26-0 🚀
|
|
Deploy Blocker #83468 was identified to be related to this PR. |
…ccounting-integrations Add bulk export to accounting integration
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.3.26-8 🚀
|
|
🚀 Deployed to staging by https://github.com/arosiclair in version: 9.3.37-0 🚀
|
|
🚀 Deployed to production by https://github.com/cristipaval in version: 9.3.37-10 🚀
|

Explanation of Change
Fixed Issues
Part of #79515
PROPOSAL: #79515 (comment)
Tests
Same QA step
Offline tests
QA Steps
Precondition: The workspace is connected to an accounting integration (for example, QuickBooks Online).
“Exported to QuickBooks Online and successfully created a record for out-of-pocket expenses.”
If exported via QuickBooks Online:
“Exported to QuickBooks Online and successfully created a record for out-of-pocket expenses.”
If marked via Mark as exported:
“Marked this report as manually exported to QuickBooks Online.”
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, 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.ScrollViewcomponent to make it scrollable when more elements are added to the page.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
Screen.Recording.2026-02-18.at.15.07.19.mov
Android: mWeb Chrome
Screen.Recording.2026-02-18.at.15.08.52.mov
iOS: Native
Screen.Recording.2026-02-18.at.14.53.45.mov
iOS: mWeb Safari
Screen.Recording.2026-02-18.at.15.03.47.mov
MacOS: Chrome / Safari
Screen.Recording.2026-02-18.at.15.09.55.mov