From c049120efb25efd01aa0fb1a1db8f662d25be0de Mon Sep 17 00:00:00 2001 From: abaevbog Date: Tue, 25 Feb 2025 02:24:59 -0800 Subject: [PATCH] do not try to select deleted item in a collection (#5061) After navigating to the collection from "Libraries and Collections" section of an item in the trash. Deleted item does not appear in actual collections and trying to select it will just re-select the trash. Fixes: #5060 --- chrome/content/zotero/elements/librariesCollectionsBox.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/elements/librariesCollectionsBox.js b/chrome/content/zotero/elements/librariesCollectionsBox.js index 15eebeb8b2..5e21f9df1c 100644 --- a/chrome/content/zotero/elements/librariesCollectionsBox.js +++ b/chrome/content/zotero/elements/librariesCollectionsBox.js @@ -157,7 +157,12 @@ import { getCSSIcon } from 'components/icons'; if (!disableClicky) { box.addEventListener('click', async () => { await ZoteroPane.collectionsView.selectByID(obj.treeViewID); - await ZoteroPane.selectItem(contextItem.id); + // Do not try to view deleted items in a collection. + // They do not appear outside of trash, and selecting a deleted item + // will re-open trash in collectionTree. + if (!contextItem.deleted) { + await ZoteroPane.selectItem(contextItem.id); + } }); }