Make payment flow independent on existance of report preview#26891
Make payment flow independent on existance of report preview#26891
Conversation
src/libs/actions/IOU.js
Outdated
| ...(optimisticReportPreviewAction | ||
| ? [ | ||
| { | ||
| onyxMethod: Onyx.METHOD.MERGE, | ||
| key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${chatReport.reportID}`, | ||
| value: { | ||
| [optimisticReportPreviewAction.reportActionID]: optimisticReportPreviewAction, | ||
| }, | ||
| }, | ||
| ] | ||
| : [] | ||
| ), |
There was a problem hiding this comment.
I'm not really a fan of adding the spread operator, and the ternary, and the empty arrays. I think that makes it very confusing to know what's going on. What I would suggest is to do something more like:
if (optimisticReportPreviewAction) {
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${chatReport.reportID}`,
value: {
[optimisticReportPreviewAction.reportActionID]: optimisticReportPreviewAction,
},
});
}
|
@ 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] |
Reviewer ChecklistThis is a bit unorthodox, but since we're dealing with a fire for the SBE launch, I am making the call to skip full-platform testing. I tested it on web and it worked: Skipping the rest of the reviewer checklist and @hayata-suenaga you don't need to do anything here. |
tgolen
left a comment
There was a problem hiding this comment.
Looks good now, thank you.
|
✋ 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 build in android and iOS. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/tgolen in version: 1.3.65-0 🚀
|
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.3.65-7 🚀
|
|
🚀 Deployed to staging by https://github.com/tgolen in version: 1.3.66-0 🚀
|
|
🚀 Deployed to production by https://github.com/Beamanator in version: 1.3.66-3 🚀
|

Details
When the report preview which is a parent of the IOU/ expense report is s whisper and the admin/ payer is not in the list of accounts to whisper the action to, they do not have that action locally. This leads to error and inability to pay the expense report, because the optimistic actions are updating the report preview assuming its always there.
Fixed Issues
$ https://expensify.slack.com/archives/C05DWUDHVK7/p1694017256052129?thread_ts=1693949568.506649&cid=C05DWUDHVK7
Tests
Offline tests
N/A
QA Steps
Same as tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)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
26891web.mp4
Web
Mobile Web - Chrome
Mobile Web - Safari
Desktop
iOS
Android