Skip to content

Commit

Permalink
[lib] Deduplicate in getCandidateSidebarItemsForThreadList
Browse files Browse the repository at this point in the history
Summary:
I made a mistake in D14154: I forgot to deduplicate the "general" and unread results.

Depends on D14157

Test Plan: Confirm I no longer see duplicated candidate sidebar items

Reviewers: varun, will

Reviewed By: varun

Subscribers: tomek

Differential Revision: https://phab.comm.dev/D14158
  • Loading branch information
Ashoat committed Dec 14, 2024
1 parent 8266d4d commit e5327d5
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/shared/sidebar-item-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,16 @@ async function getCandidateSidebarItemsForThreadList(
topUnreadPromise,
]);

const topResults = [
...topGeneralResults.slice(0, maxReadSidebars),
...topUnreadResults.slice(0, maxUnreadSidebars),
];
const topResults = topUnreadResults.slice(0, maxUnreadSidebars);
const topThreadIDs = new Set([
...topResults.map(result => result.threadInfo.id),
]);
const generalResults = topGeneralResults.slice(0, maxReadSidebars);
for (const result of generalResults) {
if (!topThreadIDs.has(result.threadInfo.id)) {
topResults.push(result);
}
}

return topResults.map(result => {
const {
Expand Down

0 comments on commit e5327d5

Please sign in to comment.