-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Migrate MoneyRequestParticipantsSplitSelector.js to function component #20271
Migrate MoneyRequestParticipantsSplitSelector.js to function component #20271
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
@marcaaron 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] |
I have read the CLA Document and I hereby sign the CLA |
personalDetails, | ||
userToInvite | ||
}); | ||
}, [props.betas, props.reports, props.participants, props.personalDetails, searchTerm]) |
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.
Hi @multijump, I think we should re-render if props.translate
changes also.
i.e. if the language is changed on device B, device A should re-render.
Does that make sense?
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.
Hi, @rushatgabhane
Yes, that make sense.
just updated following your instruction.
Thanks.
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.
@multijump keyboard navigation isn't working on split bill page
Hi, @rushatgabhane
I think it is related with OptionsSelector component. |
@multijump it's failing on this PR only, right? If It's working on |
@rushatgabhane |
@multijump @Julesssss sorry im out sick and won't be able to review this PR in time. @allroundexperts on c+ channel said that they're taking over, thanks! |
Hey @allroundexperts, just wanted to double check your taking over the review? If so I'll update the linked issue. |
Yes. I'll be reviewing this today. |
…to 16280_refactor_MoneyRequestParticipantsSplitSelector
personalDetails, | ||
userToInvite, | ||
}); | ||
props.onAddParticipants(newSelectedOptions); |
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.
Why are you changing the order here?
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.
Hi, @allroundexperts
There was not special reason.
I thought simply props change (for participants) doesn't affect to toggleOption function running so it doesn't matter where it is.
But I thought changing order was more readable and understandable.
If you require to change the order, I will change it.
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 very difficult to compare the before and after code with the order changed. Can you please change the order as it was previously? Thanks!
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.
Hi, @allroundexperts
Restored order per your request.
setNewChatOptions({ | ||
recentReports, | ||
personalDetails, | ||
userToInvite, | ||
}); |
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.
Please use this inside the callback like it was being done previously.
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.
@allroundexperts
This setState doesn't depend on previous state so previousState will be the unused variable.
Do we need to implement to use the callback?
* Once a single or more users are selected, navigates to next step | ||
*/ | ||
const finalizeParticipants = () => { | ||
props.onStepComplete(); | ||
}; |
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.
Again, why is the order being changed here?
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.
Hi, @allroundexperts
There is no reason.
I paid more attention to convert toggleOption and getSections function because these functions are main functions in this component.
So I converted them first and then finalizeParticipants.
That's why changed the order.
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.
Just for my understanding, why don't we use withCallback
here? I assume it's not necessary, but I'm still trying to understand hooks.
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 think we don't need to even wrap this inside the function since the function does nothing other than calling the function supplied in the prop. @multijump can you please remove this and use the prop directly?
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.
Hi, @allroundexperts
Updated to use the prop directly.
this.props.onStepComplete(); | ||
} | ||
return newSections; | ||
// eslint-disable-next-line react-hooks/exhaustive-deps -- props does not need to be a dependency as it will always exist |
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.
Why are you disabling this check?
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 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 seems like we're no longer disabling the check, but I think it dows make sense, right? We shouldn't update after ANY prop is changed, just specific ones?
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.
That's correct @Julesssss. We've added into dependency all the properties that should trigger a re-calculation of values in the function.
setSearchTerm(''); | ||
} | ||
}, | ||
// eslint-disable-next-line react-hooks/exhaustive-deps -- props does not need to be a dependency as it will always exist |
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 question
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 got a warning when I checked lint. So I checked the useMemo and useCallback functions in other components and I noticed they did same comment. That's why I disabled it.
@multijump It's looking good largely. Can you please resolve the conflict and reply to a few more comments? |
Hi, @allroundexperts |
Thanks @multijump! |
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-06-24.at.3.08.33.AM.movMobile Web - ChromeScreen.Recording.2023-06-24.at.3.25.06.AM.movMobile Web - SafariScreen.Recording.2023-06-24.at.3.24.23.AM.movDesktopScreen.Recording.2023-06-24.at.3.12.27.AM.moviOSScreen.Recording.2023-06-24.at.3.26.18.AM.movAndroidScreen.Recording.2023-06-24.at.3.29.56.AM.mov |
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.
Looking good. Thanks for the changes and your patience @multijump!
Actually, we had another discussion here and it was decided that we'll be favouring prop de-structuring instead disabling the |
…to 16280_refactor_MoneyRequestParticipantsSplitSelector
Hi, @allroundexperts |
@allroundexperts could you please resolve the threads that have been addressed, thanks. |
@Julesssss All threads have been fixed. I can not |
Tests well |
✋ 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/Julesssss in version: 1.3.37-0 🚀
|
@Julesssss This took a lot of time to review back and forth. If possible, can we please consider bumping this to our standard bounty price of $1k? |
I agree this took longer than average, but personally, I think that balances out against simpler reviews that still have the $1000 bounty. Also, I don't think the bounty itself should be updated, as it would encourage that a slower contributor PR ends up being paid more than a faster one. If you disagree I'm happy to share with others internally though to get more peoples thoughts! Let me know what you think. |
Nopes. I agree with you 👍 |
Great, thanks for understanding. Maybe the circumstances will be different next time 👍 |
🚀 Deployed to production by https://github.com/Julesssss in version: 1.3.37-7 🚀
|
Details
Migrate MoneyRequestParticipantsSplitSelector.js to function component
Fixed Issues
$ #16280
PROPOSAL: (#16280 (comment))
Tests
Offline tests
Follow the same steps listed in the section above
QA Steps
Follow the same steps listed in the section above
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)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)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
Web
Web.mov
Mobile Web - Chrome
Mobile.Web.-.Chrome.mov
Mobile Web - Safari
Mobile.Web.-.Safari.mov
Desktop
Desktop.mov
iOS
iOS.mov
Android
Android.mov