Repository navigation
Allow failed image/receipt uploads to be retried - #54551
Conversation
|
After checking again, there is a new issue on Android Native where the "Try Again" feature causes the receipt to appear uploaded in the app but fails during the actual upload process. This likely happens because the receipt is currently stored in the I think we need to explore an alternative approach for fetching images on Android. Still looking for a possible fix Android-Native.mp4 |
|
@nyomanjyotisa Have you found the solution? |
|
Yes, the issue on Android Native has been resolved |
|
@dukenv0307 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] |
|
@nyomanjyotisa What about this place: Line 1533 in 1cfcfa4 action and retryParams?
|
| filename?: string, | ||
| isScanRequest = true, | ||
| errorKey?: number, | ||
| action?: string, |
There was a problem hiding this comment.
We should defined the action enum here
| return isEmptyObject(receipt) || !isScanRequest | ||
| ? ErrorUtils.getMicroSecondOnyxErrorWithTranslationKey('iou.error.genericCreateFailureMessage', errorKey) | ||
| : ErrorUtils.getMicroSecondOnyxErrorObject({error: CONST.IOU.RECEIPT_ERROR, source: receipt.source?.toString() ?? '', filename: filename ?? ''}, errorKey); | ||
| : ErrorUtils.getMicroSecondOnyxErrorObject( |
There was a problem hiding this comment.
In case users manually request money within receipt, the isScanRequest will be false, so the receipt error will not added to failureData. IMO, isEmptyObject(receipt) is enough, but not sure why the author add !isScanRequest check. Can you check this case?
There was a problem hiding this comment.
I agree, isEmptyObject(receipt) should be enough in this case. I’m not entirely sure why that additional check was included either. If I remove the !isScanRequest condition, this line will cause the generic error to display, resulting in a duplicate error message.
There was a problem hiding this comment.
How can you show these messages? I can't reproduce on my side
Screen.Recording.2025-01-06.at.11.18.41.mov
I think this line doesn't relate to isScanRequest. No matter what isScanRequest is, this error message is still added.
There was a problem hiding this comment.
@nyomanjyotisa But I think it's expected not to show receipt error in case manual request. So we should update the test steps.
For manual request: Show the generic message
For receipt request: Show the image error message
| }, | ||
| }); | ||
|
|
||
| type StartSplitBilActionParams = { |
There was a problem hiding this comment.
I think we will refactor the params in this issue so we shouldn't create the new type in this PR.
There was a problem hiding this comment.
If that’s the case, how would you suggest handling retryParams in getReceiptError without introducing a new parameter like StartSplitBillActionParams? I believe the parameters haven’t been fully addressed in the mentioned issue yet right?
There was a problem hiding this comment.
Actually, you didn't introdude the new StartSplitBilActionParams, you just moved it to other place. So it's fine
|
I tested the |
Correct me if I'm wrong, but I don't think |
Yah, so I think we don't need to add |
|
@nyomanjyotisa Some tests are failed, can you pls check? |
|
Sorry for the late response. The failed test has been solved @dukenv0307 |
|
Reviewing... |
| ? (JSON.parse(message.retryParams) as IOU.ReplaceReceipt | IOU.StartSplitBilActionParams | IOU.TrackExpense | IOU.RequestMoneyInformation) | ||
| : message.retryParams; | ||
|
|
||
| switch (message.action) { |
| <Text style={[StyleUtils.getDotIndicatorTextStyles(isErrorMessage)]}>{Localize.translateLocal('iou.error.receiptFailureMessage')}</Text> | ||
| <TextLink | ||
| style={[StyleUtils.getDotIndicatorTextStyles(), styles.link]} | ||
| onPress={() => { |
There was a problem hiding this comment.
Can you pls define the new function for it (instead of anonymous func) ?
|
bump @kavimuru could you test using the suggestion @nyomanjyotisa provided above? |
|
@kavimuru any updates? |
|
Pinged in slack https://expensify.slack.com/archives/C9YU7BX5M/p1741698192459229 |
|
Test 1 (Replace Receipt): Screen.Recording.20250311.215139.New.Expensify.Adhoc.mp42025-03-11.10.20.47.PM.mp4Test.1.Replace.Receipt.part.2.mp4Test.1.Replace.Receipt.part.1.mp42025-03-11.10.09.35.PM.mp4 |
|
@nyomanjyotisa Can you please resolve the conflicts and check the above issues? |
|
I think the issues mentioned above are caused by the behavior of 'Simulate failing network requests'. When we use it instead of blocking the network request URL, the upload is actually not failing. Even if the user dismisses the error (the new receipt should not be uploaded), the receipt was actually uploaded. We can see the uploaded receipt after clearing the cache and restarting the app. Here is the detail: New-Expensify.mp4However, if we want to test the functionality of the 'try again', 'save', and 'dismiss' buttons, we can change the test steps to something like this: Test 1Test 1 (Replace Receipt):
Replace-Receipt.mp4Test 2Test 2 (Split expense):
Split-Expense.mp4Test 3Test 3 (Track Expense):
Track-Expense.mp4Test 4Test 4 (Request Money - Scan): Precondition
Request-Money.mp4Please note that four new expenses will be created for tests 2, 3, and 4 because when we dismiss or save the receipt, the expenses are actually created instead of being dismissed (due to the 'Simulate failing network requests' behavior). Additionally, when we click on 'try again', two expenses will be created since 'try again' calls the API to create the expense again What do you think? Should we change the test steps? @dukenv0307 |
|
@nyomanjyotisa Yes, please |
|
@kavimuru Can you please check again? We should merge this PR soon |
|
Android: test.2-.Fail.mp4Desktop: test3-fail.self.dm.disappears.mp4iOS and mweb tests are pending |
|
I don't think the code is failing since I can’t reproduce the same error on the web for split expense or on the desktop for track expense. Could you please confirm this on your side? @dukenv0307 Web (Test 2) MacOS-Chrome.mp4Desktop (Test 3) MacOS-Desktop.mp4 |
|
@kavimuru @nyomanjyotisa I also can't reproduce, all tests passed on my side web-resize.mp4Screen.Recording.2025-03-19.at.10.51.33.mov |
|
It seems to work for me too. I think we can move forward then. Looks like we need a rebease again and then do final reviews. |
|
PR updated |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/justinpersaud in version: 9.1.18-0 🚀
|
|
🚀 Deployed to production by https://github.com/cristipaval in version: 9.1.18-4 🚀
|
| let transactionID; | ||
| if (isMoneyRequestAction(action)) { | ||
| transactionID = getOriginalMessage(action)?.IOUTransactionID; | ||
| revert(transactionID, getLastModifiedExpense(reportID)); |
There was a problem hiding this comment.
Coming from #59434, this change has caused a regression; we have to revert the transaction when the update request fails.


Explanation of Change
Fixed Issues
$ #50507
PROPOSAL: #50507 (comment)
Tests
Same as QA Steps
Offline tests
Same as QA Steps
QA Steps
Test 1 (Replace Receipt):
Test 2 (Split Expense):
Test 3 (Track Expense):
Test 4 (Request Money - Scan):
Precondition
Test 5 (Request Money - Manual):
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))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.Chrome.mp4
iOS: Native
iOS-Native.mp4
iOS: mWeb Safari
iOS-mWeb.Safari.mp4
MacOS: Chrome / Safari
MacOS-Chrome.mp4
MacOS: Desktop
MacOS-Desktop.mp4