Fix issue with option disappearing when selected for new contacts#30017
Fix issue with option disappearing when selected for new contacts#30017marcochavezf merged 11 commits intomainfrom
Conversation
Deploying with
|
| Latest commit: |
39afd7b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://faf8d1da.helpdot.pages.dev |
| Branch Preview URL: | https://jack-fixerrorfornewaccounts.helpdot.pages.dev |
|
@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.
Isn't this almost the same as above? If so, it makes sense to move this to a common place.
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.
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.
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: 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 ⚡ |
|
@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 |
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 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
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