diff --git a/lib/shared/sidebar-item-utils.js b/lib/shared/sidebar-item-utils.js --- a/lib/shared/sidebar-item-utils.js +++ b/lib/shared/sidebar-item-utils.js @@ -132,7 +132,7 @@ ): Promise<$ReadOnlyArray> { if (sidebarInfos.length === 0) { return []; - } else if (sidebarInfos.length <= maxUnreadSidebars) { + } else if (sidebarInfos.length <= maxUnreadSidebars + 1) { return await getAllFinalSidebarItems(sidebarInfos); } @@ -164,20 +164,22 @@ loaders.filter(loader => loader.threadInfo.currentUser.unread), ); - const topGeneralPromise = - generalCache.loadMostRecentChatThreadItems(maxReadSidebars); - const topUnreadPromise = - unreadCache.loadMostRecentChatThreadItems(maxUnreadSidebars); + const topGeneralPromise = generalCache.loadMostRecentChatThreadItems( + maxReadSidebars + 1, + ); + const topUnreadPromise = unreadCache.loadMostRecentChatThreadItems( + maxUnreadSidebars + 1, + ); const [topGeneralResults, topUnreadResults] = await Promise.all([ topGeneralPromise, topUnreadPromise, ]); - const topResults = topUnreadResults.slice(0, maxUnreadSidebars); + const topResults = topUnreadResults.slice(0, maxUnreadSidebars + 1); const topThreadIDs = new Set([ ...topResults.map(result => result.threadInfo.id), ]); - const generalResults = topGeneralResults.slice(0, maxReadSidebars); + const generalResults = topGeneralResults.slice(0, maxReadSidebars + 1); for (const result of generalResults) { if (!topThreadIDs.has(result.threadInfo.id)) { topResults.push(result);