fix: Added better error handling for AddTrackedExpenseToPolicy API#83322
fix: Added better error handling for AddTrackedExpenseToPolicy API#83322Valforte merged 4 commits intoExpensify:mainfrom
Conversation
|
I was having problem while recording on Android, will add recordings on android later. |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a37b0ed748
ℹ️ 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".
joekaufmanexpensify
left a comment
There was a problem hiding this comment.
Good for product 👍
…sts already otherwise it'll be cleared
|
Added the recordings on Android and added the codex suggestion. |
|
@suneox Bump for updates on this PR, Thanks. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppCleanShot.2026-03-11.at.01.54.51.5.mp4Android: mWeb ChromeCleanShot.2026-03-11.at.01.52.13.4.mp4iOS: HybridAppCleanShot.2026-03-11.at.01.50.34.3.mp4iOS: mWeb SafariCleanShot.2026-03-11.at.01.47.50.2.mp4MacOS: Chrome / SafariCleanShot.2026-03-11.at.01.44.11.1.mp4 |
|
@Uzaifm127 When reverting optimistic data in cases where an existing report group is present, the red dot still appears on the report group. CleanShot.2026-03-04.at.00.46.36.1.mp4 |
src/libs/actions/IOU/index.ts
Outdated
| const additionalFailureData: Array<OnyxUpdate<BuildOnyxDataForMoneyRequestKeys>> = []; | ||
| const iouReport = allReports?.[`${ONYXKEYS.COLLECTION.REPORT}${iouParams.reportID}`]; | ||
| const shouldClearOptimisticIOUReport = !iouReport || iouReport.pendingFields?.createChat === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD; | ||
|
|
There was a problem hiding this comment.
We can move logic rebuild the additionalFailureData into getConvertTrackedExpenseInformation function
There was a problem hiding this comment.
Moved the entire logic of building the additional failure data to a new function.
|
@suneox Apology for the delay, will look into this and provide the updates within 2 days. |
…dm and move the additional failure data building logic in a function
Fixed. mac-os.mp4 |
|
@suneox Bump for updates here. Thanks. |
The fallback functionality for failed values works. I’ve also updated the checklist |
|
🚧 @Valforte 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/Valforte in version: 9.3.37-0 🚀
|
|
@Uzaifm127 @suneox Could you please confirm what is expected behaviour when disable simulate network failure request? The expense automatically moves to the workspace chat without retrying the submission. The expense disappears from Self DM. Is this an issue? Bug7101868_1773386724651.Screenrecorder-2026-03-13-12-44-23-704.mp4 |
@jponikarchuk Currently, the "Simulate Network Failure" function automatically retries after it is turned off so this behavior is expected. When The current PR improves how the previous state is restored. You can compare this with the behavior before this PR, where the error still remained even after the request succeeded |
|
@jponikarchuk Same as @suneox said. |
|
🚀 Deployed to production by https://github.com/cristipaval in version: 9.3.37-10 🚀
|
Explanation of Change
In this PR, we are adding better error handling (by removing the ghost IOU report created after submitting the expense from self DM to workspace) to
AddTrackedExpenseToPolicyAPI.Fixed Issues
$ #78359
PROPOSAL: #78359 (comment)
Tests
test-toolsand enable "Simulate failing network requests" option.Offline tests
We are implementing better error handling which doesn't require offline behaviour.
QA Steps
Same as Tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand 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-native.mp4
Android: mWeb Chrome
Android-mweb.mp4
iOS: Native
ios-native.mp4
iOS: mWeb Safari
ios-mweb.mp4
MacOS: Chrome / Safari
macOS.mp4