-
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
Cleanup props and callbacks for OptionsList #13319
Conversation
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.
What a satisfying diff. It's hard to imagine merging some of those patterns to begin with! Thanks for cleaning them up.
I'm seeing that we pass an almost identical method to OptionsSelector
each time via the onChangeText
prop. Do you think it's worth making another pass or a followup PR to reduce some of that repetition?
Reviewer Checklist
Screenshots/Videos |
I think the Tests for IOU Pages are slightly incorrect. I'm not able to select/deselect participants when I make the bill split from the group chat, but I am able to select/deselect when making the bill split from the FAB. I'm going to resume testing but wanted to mention that. |
src/pages/NewChatPage.js
Outdated
onConfirmSelection={this.props.isGroupChat ? this.createGroup : () => {}} | ||
onConfirmSelection={this.props.isGroupChat && this.createGroup} |
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 this is causing the error I posted about in the thread.
#13319 (comment)
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.
When I added a few members to a group chat, after creating the group chat I saw this console warning (Note: I tried to reproduce but only saw this once ever 🤷 ):
Also I believe I found one bug:
- Split Bill -> enter money -> select 2 or more people -> continue
- click on the people you just added - in staging, you can de-select people but on your branch, you can't. Video:
Screen.Recording.2022-12-06.at.4.11.22.PM.mov
OK, thanks for the reviews, and I'll look into some of those prop warnings. Regarding the logic for select/deselect participants, it's a bit murky. I actually have an open PR that flips some of the logic for when participants can be modified. Maybe we should put this PR on HOLD until that is merged so that we are all clear on what the correct logic is? I think that will help me, so I'll go ahead and do that, but let's keep reviewing this.
I thought about this too. The conclusion that I came to is that I couldn't really think of a very good solution. Each of those methods is unique enough and modifies the state of the parent component, so it's not something that could be generalized inside of |
OK, well... that's been merged already today, so I will go through here and try to clean up the testing steps a little to denote when you should and shouldn't be able to select people |
Updated! I fixed the prop warning that Luke found. I also checked the tests and they did have the right logic, it's just the code hadn't been updated with the correct logic. Now that the other PR was merged, this code has the correct logic, so the tests will be correct for when you can select/deselect people. I found a bug that the Lastly, the warning about the keys in virtualized list, that appears to be unrelated to these changes and it happens from the ReportActionsList in some situations (mostly when you're starting brand new chats). So, I would consider that out-of-scope of this PR to fix, but you can open a new GH for it 👍 |
I'll resume testing/review this one this evening. |
OK done with Web QA and blockers so I'm back on the review for this. |
src/components/OptionRow.js
Outdated
// export default withLocalize(memo(OptionRow, (prevProps, nextProps) => { | ||
// if (prevProps.optionIsFocused !== nextProps.optionIsFocused) { | ||
// return false; | ||
// } | ||
// | ||
// if (prevProps.isSelected !== nextProps.isSelected) { | ||
// return false; | ||
// } | ||
// | ||
// if (prevProps.mode !== nextProps.mode) { | ||
// return false; | ||
// } | ||
// | ||
// if (prevProps.option.isUnread !== nextProps.option.isUnread) { | ||
// return false; | ||
// } | ||
// | ||
// if (prevProps.option.alternateText !== nextProps.option.alternateText) { | ||
// return false; | ||
// } | ||
// | ||
// if (prevProps.option.descriptiveText !== nextProps.option.descriptiveText) { | ||
// return false; | ||
// } | ||
// | ||
// if (prevProps.option.hasDraftComment !== nextProps.option.hasDraftComment) { | ||
// return false; | ||
// } | ||
// | ||
// if (prevProps.option.isPinned !== nextProps.option.isPinned) { | ||
// return false; | ||
// } | ||
// | ||
// if (prevProps.option.hasOutstandingIOU !== nextProps.option.hasOutstandingIOU) { | ||
// return false; | ||
// } | ||
// | ||
// if (!_.isEqual(prevProps.option.icons, nextProps.option.icons)) { | ||
// return false; | ||
// } | ||
// | ||
// // Re-render when the text changes | ||
// if (prevProps.option.text !== nextProps.option.text) { | ||
// return false; | ||
// } | ||
// | ||
// if (prevProps.showSelectedState !== nextProps.showSelectedState) { | ||
// return false; | ||
// } | ||
// | ||
// if (prevProps.isDisabled !== nextProps.isDisabled) { | ||
// return false; | ||
// } | ||
// | ||
// if (prevProps.showTitleTooltip !== nextProps.showTitleTooltip) { | ||
// return false; | ||
// } | ||
// | ||
// if (prevProps.backgroundColor !== nextProps.backgroundColor) { | ||
// return false; | ||
// } | ||
// | ||
// if (prevProps.option.brickRoadIndicator !== nextProps.option.brickRoadIndicator) { | ||
// return false; | ||
// } | ||
// | ||
// return true; | ||
// })); |
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'm guessing this is not supposed to be 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.
Removed 👍 😊
OK! Looking good except for that last thing. Happy to merge as soon as that's taken care of. |
Updated and ready for final review and merge |
Alex is OOO but we want to merge now.
✋ 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 production by @chiragsalian in version: 1.2.38-6 🚀
|
I am tagging this PR to highlight an issue fixed here. All conditions in ternary expressions or left-hand operands on conditional renders, should be boolean. This PR is one of the PRs that uses conditional render with string operands, hence I am tagging it here for the contributors to check. We've also updated the item in the checklist with this PR to avoid this issue in the future. |
Details
There were a number of minor things I did here, nothing major.
hideAdditionalOptionStates
which was only used along withcustomIcons
so it wasn't necessary)Fixed Issues
This PR is partially for https://github.com/Expensify/Expensify/issues/228943 but is not a full fix. It is just a bunch of cleanup.
Tests
Most of the tests are going to be general regression tests. The best way to test these is to compare them against production for style and general behavior.
Report Participants Page
Report Search Page
IOU Pages
Split a bill from the floating-action-button:
Create a split from a group chat:
IOU Currency Selection
Request Money
New Chat Page
Workspace Invite
Offline tests
When offline, some of the avatars might only be displayed as a default or blank avatar. This is normal and expected.
QA Steps
Same as all the tests above
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
filesWaiting 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)Screenshots/Videos
Web
2022-12-05_11-36-15.mp4
Mobile Web - Chrome
2022-12-05_11-48-16.mp4
Mobile Web - Safari
2022-12-05_11-55-27.mp4
Desktop
2022-12-05_11-58-01.mp4
iOS
2022-12-05_11-52-32.mp4
Android
2022-12-05_11-44-15.mp4