Refractoring selected transactions loop#61482
Conversation
|
@yuwenmemon 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] |
|
Hi @aldo-expensify, coming from #60436 (comment). |
|
@aldo-expensify looks like this was merged without a test passing. Please add a note explaining why this was done and remove the |
|
No emergency, merged without checking author/reviewer checkboxes because we are just doing a simple refactor to make the code less confusing. |
|
✋ 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/aldo-expensify in version: 9.1.42-0 🚀
|
|
@Tony-MK @aldo-expensify Anything to QA here? |
|
I don't think so. |
|
🚀 Deployed to staging by https://github.com/aldo-expensify in version: 9.1.43-5 🚀
|
|
🚀 Deployed to production by https://github.com/francoisl in version: 9.1.44-8 🚀
|
| let canUnholdTransactions = selectedTransactions.length > 0 && isMoneyRequestReport; | ||
|
|
||
| selectedTransactions.forEach((selectedTransaction) => { | ||
| if (!canHoldTransactions && !canHoldTransactions) { |
There was a problem hiding this comment.
Coming from this issue #62403, we’re currently checking the condition if (!canHoldTransactions && !canHoldTransactions) to return early. This is causing the issue where we’re seeing the "Remove Hold" option for expenses that aren't actually held. we should be using if (!canHoldTransactions && !canUnholdTransactions) instead.
There was a problem hiding this comment.
hmm, but I think this early return is just there for "performance", I don't think it can change the outcome for canHoldTransactions and canHoldTransactions. I do agree that we should fix it regardless. Are you sure this is the cause of your bug??
There was a problem hiding this comment.
Yes, I think this is causing an issue because when canHoldTransactions is false, it never updates the value of canUnholdTransactions since it returns early in that case.
There was a problem hiding this comment.
ahh, that makes sense, thanks for explaining
Explanation of Change
Improving loop readability.
Fixed Issues
$ #60436 (comment)
PROPOSAL:
Tests
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand 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: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop