-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create optimistic report when approving/paying for report with hold expenses #42573
Create optimistic report when approving/paying for report with hold expenses #42573
Conversation
…ith-holds # Conflicts: # src/libs/actions/IOU.ts
This reverts commit a49af7b.
Done |
Oh, I prepared changes for the old report value 😅 |
I assume we're fine with not changing them then |
@war-in new PR welcome 😄 |
That's only 10 lines of code but I can create it 👍 |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
@robertjchen @ZhenjaHorbach could you jump in and verify the PR? 🙏 |
Yeah |
🚀 Deployed to staging by https://github.com/robertjchen in version: 9.0.13-0 🚀
|
🚀 Deployed to production by https://github.com/luacmartins in version: 9.0.13-4 🚀
|
Two issues were created coming from this PR:
|
chatReport.reportID, | ||
chatReport.policyID ?? iouReport.policyID ?? '', | ||
recipient.accountID ?? 1, | ||
(firstHoldTransaction?.amount ?? 0) * -1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This argument is for the total. We should have summed up the hold transactions. (Coming from #48760)
chatReport.reportID, | ||
chatReport.policyID ?? iouReport.policyID ?? '', | ||
recipient.accountID ?? 1, | ||
(firstHoldTransaction?.amount ?? 0) * -1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we edit the amount, the new amount is stored in modifiedAmount. This caused #49269
const {holdReportActions, holdTransactions} = getHoldReportActionsAndTransactions(iouReport.reportID); | ||
const firstHoldTransaction = holdTransactions[0]; | ||
|
||
const optimisticExpenseReport = ReportUtils.buildOptimisticExpenseReport( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should create the optimistic data that matches with the data from our BE.
This caused #49754 more detailed:
#49754 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should cover a case where it's an IOU report. Otherwise, it will build a wrong optimistic report, causing LHN to display a wrong message. More details here #49274 (comment)
}; | ||
}); | ||
|
||
const optimisticData: OnyxUpdate[] = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coming from #52696, We need to reset pending action in all places if we use it in optimistic data.
Details
Fixed Issues
$ #41652
PROPOSAL:
Tests
Force offline
inTroubleshooting
(to better see what happens when slow backend replies).Force offline
.Offline tests
QA Steps
Force offline
inTroubleshooting
(to better see what happens when slow backend replies).Force offline
.PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
ios.native.mov
iOS: mWeb Safari
ios.web.mov
MacOS: Chrome / Safari
Screen.Recording.2024-07-24.at.16.15.15.mov
MacOS: Desktop
Desktop.video.mov