fix: getting unselected participants#32823
Conversation
|
@cubuspl42 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] |
| const optionSelectorSections = useMemo(() => { | ||
| const sections = []; | ||
| const unselectedParticipants = _.filter(selectedParticipantsFiltered, (participant) => !participant.selected); | ||
| const unselectedParticipants = _.filter(selectedParticipants, (participant) => !participant.selected); |
There was a problem hiding this comment.
My gosh, these names are confusing. So we have...
selectedParticipantsselectedParticipantsFiltered,filtered onparticipant.selectedunselectedParticipants, alsofiltered, but on the negation of the above, i.e. on!participant.selected
Also, we consider selectedParticipantsFiltered heavy enough so it needs to be memoized, but unselectedParticipants not heavy enough to be memoized.
It's great that we found the root cause and fixed it, but maybe let's minimize the risk of a similar problem in this very area.
Do you understand the difference between selectedParticipants and selectedParticipantsFiltered? What is it actually filtered on?
/** Selected participants from MoneyRequestModal with login / accountID */
selectedParticipants: PropTypes.arrayOf(optionPropTypes).isRequired,
It sounds like these already are the "selected participants", how can they be more selected?
We need either some renaming, or some comments, or both
There was a problem hiding this comment.
selectedParticipants are the participants selected in participants page(group chat members in our case)
selectedParticipantsFiltered are participants with selected = true. User can toggle them in the confirmation page. Initially all values of selected are true
unselectedParticipants are participants with selected = false
There was a problem hiding this comment.
So maybe let's use another term for the "outer" selected participants, like chosenParticipants or pickedParticipants?
Then we could name the "inner" selected participants symmetrically, like...
selectedParticipants(whereselected = true)unselectedParticipants(whereselected = false)
I think it would be clearer to declare them close to each other.
It's important to think about why it was easy to make a mistake and what we can do so it's, well, at least a bit harder to make a similar one in the future.
I searched the code briefly and it seems that there are not many usages to fix.
There was a problem hiding this comment.
Please check again and let me know your thoughts
Reviewer Checklist
Screenshots/VideosWebfix-participant-selection-web.mp4Mobile Web - Chromefix-participant-selection-android-web-compressed.mp4Mobile Web - Safarifix-participant-selection-ios-web.mp4DesktopiOSfix-participant-selection-ios.mp4Androidfix-participant-selection-android-compressed.mp4 |
|
@tgolen Let me know if you agree that some renaming improves the readability here |
|
Renaming seems to improve the readability to me. Nice suggestion! |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
fix: getting unselected participants (cherry picked from commit e5df7f6)
|
🚀 Cherry-picked to staging by https://github.com/luacmartins in version: 1.4.11-4 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
|
🚀 Deployed to production by https://github.com/Julesssss in version: 1.4.11-25 🚀
|
Details
Get unselected participants from the original participants list
Fixed Issues
$ #32808
PROPOSAL: #32808 (comment)
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)StyleUtils.getBackgroundAndBorderStyle(theme.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
Android: Native
32808_android_native.mp4
Android: mWeb Chrome
32808_android_chrome.mp4
iOS: Native
32808_ios_native.mp4
iOS: mWeb Safari
32808_ios_safari.mp4
MacOS: Chrome / Safari
32808_mac_chrome.mp4
MacOS: Desktop
32808_mac_desktop.mp4