-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
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] |
@@ -368,7 +368,7 @@ function MoneyTemporaryForRefactorRequestConfirmationList({ | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My gosh, these names are confusing. So we have...
selectedParticipants
selectedParticipantsFiltered
,filter
ed onparticipant.selected
unselectedParticipants
, alsofilter
ed, 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 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)StyleUtils.getBackgroundAndBorderStyle(theme.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
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