[HOLD for payment 2022-01-25] Rooms are duplicated in results list when searching the room by name - @Kidroca
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Action Performed:
- In a account that has at least 1 workspace
- Open search
- Search for #announce room
- Delete a character and write it again
Expected Result:
After triggering the search, there's no duplicates in the results list.
Actual Result:
After triggering the search several times there's a bunch of duplicates in the results list.
Workaround:
None needed, visual issue.
Platform:
Where is this issue occurring?
- Web
- iOS
- Android
- Desktop App
- Mobile Web
Version Number: 1.1.6-0
Reproducible in staging?: yes Reproducible in production?: yes
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation

https://user-images.githubusercontent.com/44479856/136270342-39e7bdb0-71a5-4e26-af58-fc7698136a5b.mp4
Expensify/Expensify Issue URL: Upwork Job: https://www.upwork.com/jobs/~018be34f339157da58
Issue reported by: @kidroca Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1633507668430400
Triggered auto assignment to @timszot (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.
@kidroca can you check if you have multiple announce named reports in localhost. In my case, I have multiple reports with announce name.
Triggered auto assignment to @kevinksullivan (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.
@kevinksullivan Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
I am also seeing duplicates and can reproduce the issue.

https://www.upwork.com/jobs/~018be34f339157da58
This issue has not been updated in over 15 days. eroding to Monthly issue.
P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!
It seems to be lost. I think I know why this is happening. so let's fix it.
Proposal
- We have to divide the existing https://github.com/Expensify/App/blob/c2b96c1042e8055bf8e6c689b5a358245184b5d4/src/pages/SearchPage.js#L93 into two. like
const sections = [{
title: this.props.translate('common.recents'),
data: this.state.recentReports,
shouldShow: true,
indexOffset: 0,
},
{
title: this.props.translate('common.contacts'),
data: this.state.personalDetails,
shouldShow: true,
indexOffset: this.state.recentReports.length,
}];
It fixes it.
@kevinksullivan Could you please reapply the exported label?
Looks like https://www.upwork.com/jobs/~018be34f339157da58 is closed now, going to re-apply the Engineering label to get a proposal reviewer and the External label to get somebody to export this
Triggered auto assignment to @NicMendonca (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.
@parasharrajat can you explain why that proposal fixes the issue, and why the issue is happening?
New job post: https://www.upwork.com/jobs/~014d2f47f2ea404f3b
Triggered auto assignment to @parasharrajat (Exported)
Current assignee @Jag96 is eligible for the Exported assigner, not assigning anyone new.
OK, so these are the details.
- First I think getOptions in OptionListUtils.js has a bug.
- Bug is that the personalDetails array from getOptions has a room.
- I saw that one of the room data has one participant. But it shouldn't have any participants looking into other rooms.
- Now when we parse the personalDetails, one of the user's personal details is swapped by the above room. (participant email is matched).
- When we search, we filter the reports that are present in recent reports from the personalDetailsOptions (By matching the emails).
- in Step 4, one of the participant items in personalDetailsOptions contains room information ( login key is null here). Thus the filter fails for step 5.
- Thus in a room is left in the personalDetails.
Now It is somehow being appended into the data list of the sections of the FlatList.
it looks like doing the above logic fixes it (It feels like a hack) and Actually, the code should be refactored as I suggested above even though it does not fix the main cause.
I did this debugging when you asked but initially above-posted proposal fixed it in the first attempt so I thought there might be something wrong with that code.
Good find, so it sounds like first we need to confirm that 2 is a bug and there isn't any reason for that (I'm not sure), asking in slack should help get more info on it. If it is a bug, I agree we should fix that issue first.
it looks like doing the above logic fixes it (It feels like a hack) and Actually, the code should be refactored as I suggested above even though it does not fix the main cause.
Agreed 👍
@Jag96 Any luck in finding the reason.
Ah, I was suggesting that you should dig into that part of your proposal to confirm the issue you believe is a bug is in fact a bug, and that asking in slack would probably be the easiest way to get that info.
First, due to point 2, A contact is skipped from the search whose login matches with the duplicated room's only participant. Room's info overwrites it.
As an update, there's a discussion happening in https://github.com/Expensify/App/issues/6627#issuecomment-992846498, the fix for that should fix this as well