From 3d526346771cad2a81b9141a5a32ab43a15c68da Mon Sep 17 00:00:00 2001 From: "gorbenko.pavel" Date: Tue, 11 Aug 2026 14:24:32 +0500 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=B5=D0=B4=D1=83=D0=BF=D0=BB=D0=B8?= =?UTF-8?q?=D0=BA=D0=B0=D1=86=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../features/myRequests/myRequests.service.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/webparts/requestPortal/features/myRequests/myRequests.service.ts b/src/webparts/requestPortal/features/myRequests/myRequests.service.ts index a284f12..d6967b3 100644 --- a/src/webparts/requestPortal/features/myRequests/myRequests.service.ts +++ b/src/webparts/requestPortal/features/myRequests/myRequests.service.ts @@ -539,11 +539,20 @@ function freeTextClause(query: string): string | undefined { } // Ответ Search → пары (Id элемента, его тип по префиксу Path). +// +// Дедуп по (тип, Id) — ЗДЕСЬ, а не у вызывающей стороны: во всех запросах +// стоит TrimDuplicates: false (нужно, чтобы найти черновики и «свои» копии — +// стандартная дедупликация Search иногда схлопывает и их), а без неё индекс +// может вернуть один и тот же элемент несколькими хитами (переиндексация, +// несколько «версий» в crawl). Раньше хиты превращались в строки один-в-один, +// и дубликат из индекса становился дубликатом строки в таблице — с одинаковым +// React-ключом, то есть видимым «залипанием» одной и той же заявки дважды. function hitsToEntries( results: { PrimarySearchResults: unknown[] }, types: IRequestType[] ): Array<{ id: number; type: IRequestType }> { const urls = types.map((t) => ({ type: t, url: listAbsUrl(t).toLowerCase() })); + const seen = new Set(); return (results.PrimarySearchResults as Array>) .map((r) => ({ id: Number(r.ListItemID), path: String(r.Path || '').toLowerCase() })) .filter((h) => !isNaN(h.id) && h.id > 0) @@ -551,7 +560,13 @@ function hitsToEntries( const matched = urls.filter((u) => h.path.indexOf(u.url) === 0)[0]; return matched ? { id: h.id, type: matched.type } : undefined; }) - .filter((e): e is { id: number; type: IRequestType } => !!e); + .filter((e): e is { id: number; type: IRequestType } => !!e) + .filter((e) => { + const key = `${e.type.id}-${e.id}`; + if (seen.has(key)) return false; + seen.add(key); + return true; + }); } // Дочитать поля заявок по найденным Id (Search отдаёт не все колонки, и для