Fix Sage Intacct default vendor toggle crash when vendors list is empty#95345
Fix Sage Intacct default vendor toggle crash when vendors list is empty#95345mountiny wants to merge 1 commit into
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] |
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 stepssectiontoggleReportand notonIconClick)Avatar, 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