-
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
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.
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.
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 |
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.
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 |
src/libs/PolicyUtils.ts
Outdated
@@ -227,14 +227,14 @@ function isPaidGroupPolicy(policy: OnyxEntry<Policy> | EmptyObject): boolean { | |||
* Checks if policy's scheduled submit / auto reporting frequency is "instant". | |||
* 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)
src/libs/actions/IOU.ts
Outdated
@@ -3691,10 +3691,75 @@ function sendMoneyWithWallet(report: OnyxTypes.Report, amount: number, currency: | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Loooove these helper methods since they removed duplication and made code easier to follow ❤️
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.
Is this really determining if we need to show the button or is it really determining canIOUBePaid
?
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how costly the methods above are, but maybe consider moving this if to be right at the top?
src/libs/actions/IOU.ts
Outdated
return isPayer && !isDraftExpenseReport && !iouSettled && !iouReport?.isWaitingOnBankAccount && reimbursableSpend !== 0 && !iouCanceled && !isAutoReimbursable; | ||
} | ||
|
||
function shouldShowApproveButton( |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We missed to check if the report was fully approved before passing expenseReport?.reportID
, this caused the bug #43014
Details
Fixed Issues
$ #35309
PROPOSAL: #35309 (comment)
Tests
Offline tests
Same as above
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.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 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
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