From ebdeab4b3eb85d7dd025dceeea9aca9d2e238a38 Mon Sep 17 00:00:00 2001 From: abaevbog Date: Thu, 13 Mar 2025 20:35:09 -0700 Subject: [PATCH] citation dialog: deduplicate open items (#5105) So that if there are multiple tabs opened for the same top level item, it appears only once in search results. --- .../zotero/integration/citationDialog/searchHandler.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/integration/citationDialog/searchHandler.mjs b/chrome/content/zotero/integration/citationDialog/searchHandler.mjs index 2bde0ef9fc..bd341dde43 100644 --- a/chrome/content/zotero/integration/citationDialog/searchHandler.mjs +++ b/chrome/content/zotero/integration/citationDialog/searchHandler.mjs @@ -248,7 +248,9 @@ export class CitationDialogSearchHandler { } return Zotero.Cite.getItem(itemID); }); - return items; + // Return deduplicated items since there may be multiple tabs opened for the same + // top-level item (duplicate tabs or a multiple attachments belonging to the same item) + return [...new Set(items)]; } _getSelectedLibraryItems() {