Fix Sage Intacct default vendor toggle crash when vendors list is empty#95345
Conversation
Optional-chain through vendors[0]?.id on both reimbursable and non-reimbursable export pages to prevent a crash when enabling the default vendor toggle with an empty vendors array. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@QichenZhu 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] |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppScreen_recording_20260706_185817.webmAndroid: mWeb ChromeScreen_recording_20260706_191036.webmiOS: HybridAppScreen.Recording.2026-07-06.at.6.10.03.PM.moviOS: mWeb SafariSimulator.Screen.Recording.-.iPhone.17.-.2026-07-06.at.19.08.17.movMacOS: Chrome / SafariScreen.Recording.2026-07-06.at.6.49.36.PM.mov |
Author checklistExplanation of ChangeFixes a production crash when enabling the Sage Intacct "Default vendor" switch while the synced vendors list is empty. Fixed Issues$ #95342 Tests
Offline testsCannot perform the test offline. QA StepsSame as Tests. PR Author Checklist
Screenshots/VideosAndroid: NativeScreen_recording_20260706_185817.webmAndroid: mWeb ChromeScreen_recording_20260706_191036.webmiOS: NativeScreen.Recording.2026-07-06.at.6.10.03.PM.moviOS: mWeb SafariSimulator.Screen.Recording.-.iPhone.17.-.2026-07-06.at.19.08.17.movMacOS: Chrome / SafariScreen.Recording.2026-07-06.at.6.49.36.PM.mov |
QichenZhu
left a comment
There was a problem hiding this comment.
If you tap the switch when the list is empty, it's still OFF, but you can access the vendor list. It's much better than a crash, so NAB.
| Before | After |
|---|---|
Screen.Recording.2026-07-06.at.6.20.45.PM.mov |
Screen.Recording.2026-07-06.at.6.10.03.PM.mov |
Also, ESLint is failing.
|
@stitesExpensify 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] |
Optional chaining on vendors[0]?.id already prevents the crash; no-default-id-values disallows ?? '' on string IDs. Co-authored-by: Cursor <cursoragent@cursor.com>
|
🚧 stitesExpensify has triggered a test Expensify/App build. You can view the workflow run here. |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/stitesExpensify in version: 9.4.29-0 🚀
|
|
🤖 Help site review: no docs changes required. This PR is a purely internal defensive crash fix — it adds optional chaining ( I reviewed the existing Sage Intacct help articles ( No draft PR was created since no documentation updates are needed. |
|
🚀 Deployed to staging by https://github.com/stitesExpensify in version: 9.4.31-0 🚀
|
|
🤖 Help site review — no changes required I reviewed the changes in this PR against the help site content under Conclusion: No help site updates are needed. This PR is a defensive crash fix — it adds an optional-chaining operator ( Because there is no behavior or terminology change for users, no draft docs PR was created — there is nothing to document. @mountiny, if you believe a help site change is still warranted here, let me know and I'll draft one. Otherwise, no linked help site PR is needed for this change. |
|
🚀 Deployed to production by https://github.com/grgia in version: 9.4.31-0 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
Fixes a production crash when toggling the Sage Intacct "Default vendor" switch while the synced vendors list is empty. Optional chaining previously stopped at
vendors?.[0], so accessing.idon an undefined first element threw. Applied the same defensive pattern used in QBO export pages to both reimbursable and non-reimbursable Sage Intacct export settings.Fixed Issues
$ #95342
PROPOSAL:
Tests
Offline tests
Same as tests — toggle works offline with cached policy data; no network required for the guard itself.
QA Steps
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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari