Repository navigation
fix: Approving a report causes the workspace chat to “flash” in the LHN before disappearing - #35928
Conversation
…HN before disappearing
|
@situchan any updates? |
|
@tienifr please merge main. I will complete review today |
|
@situchan merged |
This comment was marked as outdated.
This comment was marked as outdated.
situchan
left a comment
There was a problem hiding this comment.
As we made shouldShowSettlementButtton, hasIOUToApproveOrPay utils, can we also apply these to the places where you referenced this logic?
|
I just refactored the PR to create |
|
@situchan Can you help check #35928 (comment). I re-tested and it worked well |
|
@situchan I just resolved the conflicts, can you help review soon? Thanks |
|
DM to @situchan |
situchan
left a comment
There was a problem hiding this comment.
Code now looks much better
|
@situchan any updates? |
|
Bump @situchan on 1:1 |
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeiOS: NativeiOS: mWeb SafariMacOS: Chrome / Safarimultiple.requests.movsingle.request.movMacOS: Desktop |
|
@tienifr all good after addressing feedback above |
|
@situchan Thanks for your suggestion. I updated |
| * Note: Free policies have "instant" submit always enabled. | ||
| */ | ||
| function isInstantSubmitEnabled(policy: OnyxEntry<Policy>): boolean { | ||
| function isInstantSubmitEnabled(policy: OnyxEntry<Policy> | EmptyObject): boolean { |
There was a problem hiding this comment.
Is this to support the case when the policy is not loaded or what?
And if so, why was it not needed before?
There was a problem hiding this comment.
It's same as other cases if you see next line.
policy?.autoReportingFrequency
policy has optional chaining for nothing.
This came from the fact that Onyx values are optional (null on fist component render, before Onyx data is loaded)
| Report.notifyNewAction(params.chatReportID, managerID); | ||
| } | ||
|
|
||
| function shouldShowPayButton(iouReport: OnyxEntry<OnyxTypes.Report> | EmptyObject, chatReport: OnyxEntry<OnyxTypes.Report> | EmptyObject, policy: OnyxEntry<OnyxTypes.Policy> | EmptyObject) { |
There was a problem hiding this comment.
Loooove these helper methods since they removed duplication and made code easier to follow ❤️
There was a problem hiding this comment.
Is this really determining if we need to show the button or is it really determining canIOUBePaid?
There was a problem hiding this comment.
Especially here is weird to call a method called shouldShowPayButton
| const iouSettled = ReportUtils.isSettled(iouReport?.reportID); | ||
| const isOnInstantSubmitPolicy = PolicyUtils.isInstantSubmitEnabled(policy); | ||
| const isOnSubmitAndClosePolicy = PolicyUtils.isSubmitAndClose(policy); | ||
| if (!isPaidGroupPolicy) { |
There was a problem hiding this comment.
Not sure how costly the methods above are, but maybe consider moving this if to be right at the top?
| return isPayer && !isDraftExpenseReport && !iouSettled && !iouReport?.isWaitingOnBankAccount && reimbursableSpend !== 0 && !iouCanceled && !isAutoReimbursable; | ||
| } | ||
|
|
||
| function shouldShowApproveButton( |
There was a problem hiding this comment.
Same here, should this be canApproveIOU?
|
@iwiznia Thanks for your suggestion. I updated the PR |
|
@iwiznia looks like this was merged without a test passing. Please add a note explaining why this was done and remove the |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
It was a mistake, I thought they had already passed. Given the perf tests broke, going to revert this. |
This seems to be happening on other PRs as well |
|
🚀 Deployed to production by https://github.com/luacmartins in version: 1.4.50-5 🚀
|
| onyxMethod: Onyx.METHOD.MERGE, | ||
| key: `${ONYXKEYS.COLLECTION.REPORT}${expenseReport?.chatReportID}`, | ||
| value: { | ||
| hasOutstandingChildRequest: hasIOUToApproveOrPay(chatReport, expenseReport?.reportID ?? ''), |
There was a problem hiding this comment.
We missed to check if the report was fully approved before passing expenseReport?.reportID, this caused the bug #43014
| const policy = ReportUtils.getPolicy(iouReport?.policyID); | ||
|
|
||
| const shouldShowSettlementButton = canIOUBePaid(iouReport, chatReport, policy) || canApproveIOU(iouReport, chatReport, policy); | ||
| return action.childReportID?.toString() !== excludedIOUReportID && action.actionName === CONST.REPORT.ACTIONS.TYPE.REPORTPREVIEW && shouldShowSettlementButton; |
There was a problem hiding this comment.
We should exclude deleted action here. Or it would cause #63875.
Details
Fixed Issues
$ #35309
PROPOSAL: #35309 (comment)
Tests
Offline tests
Same as above
QA Steps
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)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel so 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
Screen.Recording.2024-02-14.at.15.12.02.mov
Android: mWeb Chrome
iOS: Native
Screen.Recording.2024-02-14.at.14.58.07.mov
iOS: mWeb Safari
Screen.Recording.2024-02-14.at.14.56.14.mov
MacOS: Chrome / Safari
Screen.Recording.2024-02-07.at.00.23.32.mov
MacOS: Desktop
Screen.Recording.2024-02-07.at.00.27.34.mov