-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Fixing displaying the hold and unhold option in expense report #60436
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
9ff743f
fixing hold and unhold options in MoneyReportHeader.tsx
Tony-MK 9817bb9
Holding all request reports..
Tony-MK 8c2c1a5
typos...
Tony-MK 3bae508
typos ...
Tony-MK 2ac740b
updating imports in MoneyReportHeader.tsx
Tony-MK ac649ca
Merge branch 'main' of https://github.com/Expensify/App into fix/60111
Tony-MK 749e16c
lint..
Tony-MK 4a7de48
typechecks..
Tony-MK 5c55981
prettier...
Tony-MK c30c710
Merge branch 'main' into fix/60111
Tony-MK e8b5f7a
Merge branch 'main' of https://github.com/Expensify/App into fix/60111
Tony-MK a3d384b
prettier...
Tony-MK 675bfba
Merge branch 'main' into fix/60111
Tony-MK 31cb9d0
lint..
Tony-MK 857a4ec
Merge branch 'main' into fix/60111
Tony-MK 4bf36e5
revert Expensify.tsx
Tony-MK File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@Tony-MK What is this return value supposed to do? This callback is used in a
forEachso the return is ignored... is this logic correct? Maybe what you wanted was to usesome?Uh oh!
There was an error while loading. Please reload this page.
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 should be correct because the return value is only used to stop iterating
forEachwhencanHoldTransactions || canUnholdTransactionsisfalse, meaning we can not hold or unhold all selected transactions.So,
forEachcan stop early instead of iterating over all transactions twice, like when usingsome.If there is a problem with this method, we can revert to using
some.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.
I don't think that is how
forEachworks.forEachignores the value returned by the callback:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach
Uh oh!
There was an error while loading. Please reload this page.
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.
Your correct. So, sorry about that.
Should I open a PR to revert
forEachtosome?Uh oh!
There was an error while loading. Please reload this page.
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.
no problem!
I'm not so sure really, using
somejust because it will stop when you returntruefrom the callback and ignoring the return ofselectedTransactions.some(...)doesn't sound so clean to me either. Maybe you should just keep theforEachbut drop the returned values so the code doesn't look weird.I wouldn't care much for iterating the rest of the elements.. you can add something like
to make it fast, and it is also already inside a
useMemoso this shouldn't happen all the time.