-
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
Fix issue with option disappearing when selected for new contacts #30017
Conversation
Deploying with Cloudflare Pages
|
@abdulrahuman5196 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] |
Reviewer Checklist
Screenshots/VideosWebScreen.Recording.2023-10-20.at.1.03.16.AM.movMobile Web - ChromeScreen.Recording.2023-10-20.at.1.19.41.AM.movMobile Web - SafariScreen.Recording.2023-10-20.at.1.21.15.AM.movDesktopScreen.Recording.2023-10-20.at.1.17.56.AM.moviOSScreen.Recording.2023-10-20.at.1.22.05.AM.movAndroidScreen.Recording.2023-10-20.at.1.20.24.AM.mov |
const selectedParticipantsWithoutDetails = _.filter(participants, (participant) => { | ||
const accountID = lodashGet(participant, 'accountID', null); | ||
const isPartOfSearchTerm = participant.searchText.toLowerCase().includes(searchTerm.trim().toLowerCase()); | ||
const isReportInRecentReports = _.some(newChatOptions.recentReports, (report) => report.accountID === accountID); | ||
const isReportInPersonalDetails = _.some(newChatOptions.personalDetails, (personalDetail) => personalDetail.accountID === accountID); | ||
return isPartOfSearchTerm && !isReportInRecentReports && !isReportInPersonalDetails; | ||
}); | ||
|
||
newSections.push({ | ||
title: undefined, | ||
data: _.map(selectedParticipantsWithoutDetails, (participant) => { | ||
const isPolicyExpenseChat = lodashGet(participant, 'isPolicyExpenseChat', false); | ||
return isPolicyExpenseChat ? OptionsListUtils.getPolicyExpenseReportOption(participant) : OptionsListUtils.getParticipantsOption(participant, personalDetails); | ||
}), | ||
shouldShow: !_.isEmpty(selectedParticipantsWithoutDetails), | ||
indexOffset, | ||
}); | ||
indexOffset += selectedParticipantsWithoutDetails.length; |
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.
Isn't this almost the same as above? If so, it makes sense to move this to a common place.
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.
Updated!
src/pages/NewChatPage.js
Outdated
}); | ||
indexOffset += selectedParticipantsWithoutDetails.length; | ||
} | ||
indexOffset = OptionsListUtils.formatSectionsFromSearchTerm(searchTerm, sectionsList, selectedOptions, filteredRecentReports, filteredPersonalDetails, {}, false, indexOffset); |
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.
Instead of silently mutating the sectionsList
, I think it would be better to return the list along with the index offset. Let me know what you think.
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.
Yeah I was thinking this might be odd just returning the index offset, I can update this
Hi @thienlnam, contributor here, Suggestion:Instead of getting the selected options by passing true here: App/src/pages/iou/steps/MoneyRequstParticipantsPage/MoneyRequestParticipantsSelector.js Line 240 in 1bfd5f1
And then in the end filtering from recent report and personal details in this PR, Why don't we just exclude selected participants from This would mean:
This would keep selected participants on top of list, and they will not be returned by getOptions() so no need to filter. Screencast.from.20-10-23.02.17.39.AM.IST.webm |
hmm that's actually a pretty good suggestion, let me implement it rq |
Screen.Recording.2023-10-19.at.2.06.30.PM.movI like the idea, though after testing it I'm realizing the only downside(?) is that a selected participant moves from one of the lists to the selected list and it creates this jump when selecting / unselecting |
@thienlnam, this looks like it's because of the header message. We don't want "No results found" when we clearly have results. We can change this: App/src/libs/OptionsListUtils.js Lines 1556 to 1558 in 3b3d3d1
to if (hasMatchedParticipant || (isValidEmail || isValidPhone)) {
return '';
} and move it above these conditions |
The header message is a separate thing, but I'm more mentioning the bouncing around with search. It's more prominent when you're searching and have more contacts but this is the example With your changes: Screen.Recording.2023-10-19.at.2.15.48.PM.movCurrently: |
For right now, I think the second feels a bit smoother so let's just continue with that now but once we get more feedback on the UX we can explore different explanations, but thanks for the suggestion! |
@thienlnam Lint is failing. |
@allroundexperts Just updated hahah ⚡ |
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.
Looks good!
@marcochavezf 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 checked out this PR, and am seeing major lag (3-4s) when selecting participants in a high traffic account (large personal details array) Screencast.from.20-10-23.03.15.33.AM.IST.webm |
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.
Code LGTM
I think we can improve the lag in a follow-up PR, I will merge the PR since it's impacting the selection of participants |
✋ 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 issue with option disappearing when selected for new contacts (cherry picked from commit 550dbf5)
🚀 Cherry-picked to staging by https://github.com/francoisl in version: 1.3.87-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/francoisl in version: 1.3.87-12 🚀
|
Details
Fixed Issues
$ #29917
PROPOSAL:
Tests
Same as QA
Offline tests
Same as online
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)/** 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
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
Screen.Recording.2023-10-19.at.12.44.07.PM.mov
MacOS: Chrome / Safari
Screen.Recording.2023-10-19.at.12.43.24.PM.mov
MacOS: Desktop
https://github.com/Expensify/App/assets/30609178/ee01f410-c980-4eb8-8345-d5f2f12880b8