-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Fix/24389 - Request a money - Clicking on the avatar open a wrong profile #24624
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
pecanoro
merged 10 commits into
Expensify:main
from
spcheema:fix/24389-request-a-money-clicking-on-the-avatar-open-a-wrong-profile
Aug 22, 2023
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d6c7de8
Display participants list when there are multiple avatars for IOU rep…
spcheema d162c91
Memoized dependency variable
spcheema b84c560
Buld participants list
spcheema 085f972
Update comment
spcheema 85ad12e
Display participants list on clicking avatars on IOU report header
spcheema 988ae48
Remove report util changes
spcheema 001b04a
Code lint
spcheema 9c476bb
Show details/profile on clicking request money header avatars
spcheema 9256f94
Merge branch 'main' into fix/24389-request-a-money-clicking-on-the-av…
spcheema 5594626
Merge branch 'main' into fix/24389-request-a-money-clicking-on-the-av…
spcheema 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
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.
There is no need to use
useMemohere. I don't understand why it's usedPlease tell me if I missed something
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.
We should use it because - it's used inside deps for useCallback - const showActorDetails = useCallback(() => {,
and any new render will create displayAllActors (without memo) which will re-creates useCallback - which should not be
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.
either we should not use useMemo and useCallback or should use it correctly with memoizing deps
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.
displayAllActorswould change depends onprops.action.actionNameandprops.iouReportregardless the use ofuseMemo. If those props don't change,displayAllActorswon't be changed.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.
yes - and if displayAllActors (if we use useMemo) will not changed - useCallback will also not be changed
Without useMemo - displayAllActors will be as usual variable - which will be re-created every time - and will cause re-creation of useCallback
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 agree with @s-alves10 (this one). Btw,
displayAllActorswill returnprops.iouReportobject if it's true instead of a boolean. I think we should wrap it with a Boolean? (Boolean(props.iouReport))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.
After some checks - i agree that simple passed variable will not trigger recreation of useCallback. Here can be 2 options either leave as it's now in case props.iouReport is object and useMemo needed here or refactor as @bernhardoj suggested to Boolean(props.iouReport) and remove useMemo. I think it's not critical
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.
If nothing is going to break, I think we can leave it as is and maybe we can clean up in the future. It's just semantics, I also missed it, I thought it was necessary, but it is also true you guys are probably more knowledgable about React that me 😄
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.
@pecanoro @narefyev91 Is there any action we need to take now? Or we have decided to refactor 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.
We good to jump on it later