From e839c04f7737cba72c9b72ef10f3bd16e37f23e1 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Sat, 15 Apr 2023 13:51:13 +0200 Subject: [PATCH] Global Search: Fix broken layout due to duplicated search results --- src/global/reducers/globalSearch.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/global/reducers/globalSearch.ts b/src/global/reducers/globalSearch.ts index 06702c37f..79648dc66 100644 --- a/src/global/reducers/globalSearch.ts +++ b/src/global/reducers/globalSearch.ts @@ -54,7 +54,9 @@ export function updateGlobalSearchResults( } const prevFoundIds = foundIdsForType || []; - const newFoundIds = newFoundMessages.map((message) => getComplexKey(message)); + const newFoundIds = newFoundMessages + .map((message) => getComplexKey(message)) + .filter((id) => !prevFoundIds.includes(id)); const foundIds = Array.prototype.concat(prevFoundIds, newFoundIds); const foundOrPrevFoundIds = areSortedArraysEqual(prevFoundIds, foundIds) ? prevFoundIds : foundIds;