Conversation
|
Hi @cead22, any chance we could get this reviewed anytime soon? |
Co-authored-by: Carlos Alvarez <cead22@gmail.com>
Co-authored-by: Carlos Alvarez <cead22@gmail.com>
|
@cead22 thanks for the reviews, resolved all, you might want to take a look again. |
|
@gedu do you mind giving this another look before I merge? |
| BaseInvertedFlatList.defaultProps = defaultProps; | ||
| BaseInvertedFlatList.displayName = 'BaseInvertedFlatList'; | ||
|
|
||
| export default forwardRef((props, ref) => ( |
There was a problem hiding this comment.
Seems from this thread that we are changing the way to use forwardRef, the documentation will be updated soon, I think we can use the new way
|
@cead22 will be a new way to use that's my only comment, all LGTM |
Can you share more details? I'm not familiar with this change. If we're ready to do it now and that's the ideal way to do it moving forward, then let's do it in this PR |
|
@cead22 just double check and isn't ready yet, so I think the PR is good |
|
@teneeto conflicts. @s77rt can you please complete the reviewer checklist? I'm not sure why you were automatically assigned to this (or @danieldoglas for that matter) |
Reviewer Checklist
Screenshots/Videos |
|
My bad it took me a while to get to this. We have merge conflicts |
|
@teneeto in case you missed the previous notification, we still have conflicts in this PR |
|
No problem, and no rush, I just wanted to make sure you saw this |
…ate-base-inverted-flat-list-file-to-function-component
|
Retested. Looks good to me 👍 |
|
A fresh approval is needed here 😉! |
|
|
||
| return ( | ||
| <FlatList | ||
| // eslint-disable-next-line react/jsx-props-no-spreading |
There was a problem hiding this comment.
Is there a reason we're suppressing this here instead of updating the code to comply with this rule?
There was a problem hiding this comment.
AFAIK there is no solution for this one. This is how we are passing props in the codebase. We can instead pass every prop explicitly but we have so many that ignoring the rule feels better.
When not to use the rule: If you are not using JSX or have lots of props to be passed or the props spreading is used inside HOC.
There was a problem hiding this comment.
I work on App much much less than you all, but I actually don't think ignoring the rule is better, and I'd love for us to consider passing all props explicitly
- It makes the code easier to understand, because you know what's being passed without having to go up the component hierarchy
- It prevents sending down extra props that aren't needed (maybe there are ways this is prevented that I don't know about)
- Remove the rule would be better than having it and ignoring it
There was a problem hiding this comment.
When not to use the rule: If you are not using JSX or have lots of props to be passed or the props spreading is used inside HOC.
I think this is close, except the "have lots of props to be passed" is kind of misleading. The case where it's OK to use the spread operator is when you have a wrapper component that can pass any vast number of props and there is no way to know what those props will be.
This is why it's OK to be used inside an HOC (because it's generic and any component can be passing props).
I think there is another case worth mentioning and that is when there is a wrapper around a native-built or a third-party component. I don't think we would want to try and explicitly pass every prop that is available to those components (ie. we might not know all the props, or the props might change with library updates that we would not catch and know about).
That's why I think there is a pretty good case for using the spread operator here.
For the majority of cases, we shouldn't use the spread operator and therefore it's still valuable for the ESlint rule to be there. It gives us a chance to do a thorough review of all the exceptions.
There was a problem hiding this comment.
@cead22 how do we proceed with this? should we not suppress the warning? Also AFFAIK, there are many other exceptional cases as this for HOCs.
There was a problem hiding this comment.
Yeah that makes sense. We can continue that discussion elsewhere without blocking this PR on it
|
Congrats, that’s your 5th PR merged! 🎉 Do you know about the ContributorPlus role? It’s an opportunity to earn more in the Expensify Open Source community. Keep up the great work - thanks! |
|
✋ 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/cead22 in version: 1.3.77-0 🚀
|
|
🚀 Deployed to production by https://github.com/mountiny in version: 1.3.77-7 🚀
|






Details
This change is made to migrate the BaseInvertedFlatList.js from class to a function component
Fixed Issues
$: 16168
PROPOSAL: 16168
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)/** comment above it */thisproperly so there are no scoping issues (i.e. foronClick={this.submit}the methodthis.submitshould be bound tothisin the constructor)thisare necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);ifthis.submitis never passed to a component event handler likeonClick)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)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
Web
Screen.Recording.2023-09-07.at.02.23.20.mov
Mobile Web - Chrome
Screen.Recording.2023-09-07.at.02.24.24.mov
Mobile Web - Safari
Screen.Recording.2023-09-07.at.02.22.03.mov
Desktop
Screen.Recording.2023-09-07.at.02.25.58.mov
iOS
Screen.Recording.2023-09-07.at.02.17.55.mov
Android
Screen.Recording.2023-09-07.at.02.40.09.mov