From ad90d4b76f1e369cfa3aae6cd1ec17aae54d7473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adomas=20Ven=C4=8Dkauskas?= Date: Fri, 7 Aug 2026 07:23:01 +0000 Subject: [PATCH] Citation Explorer: snapshot rows before async actions --- chrome/content/zotero/integration/citationExplorer.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/integration/citationExplorer.js b/chrome/content/zotero/integration/citationExplorer.js index b5917adb76..361c201f91 100644 --- a/chrome/content/zotero/integration/citationExplorer.js +++ b/chrome/content/zotero/integration/citationExplorer.js @@ -717,6 +717,10 @@ window.ZoteroCitationExplorer = { }, onItemRelink: async function () { + let treeRow = itemList.getRow(itemList.selection.focused); + if (!(treeRow instanceof CitationExplorerItemTreeRow) || treeRow.isLinked) return; + let oldItemID = treeRow.id; + let io = { dataIn: null, dataOut: null, multiSelect: false, deferred: Zotero.Promise.defer() }; window.openDialog('chrome://zotero/content/selectItemsDialog.xhtml', '', 'chrome,dialog=no,centerscreen,resizable=yes', io); @@ -730,9 +734,6 @@ window.ZoteroCitationExplorer = { if (!items.length) { return; } - let treeRow = itemList.getRow(itemList.selection.focused); - if (treeRow instanceof LibraryItemTreeRow) return; - const oldItemID = treeRow.id; const itemIdx = itemRows.findIndex(row => row.id === oldItemID); this._linkItem(items[0], oldItemID, itemIdx);