Citation Explorer: snapshot rows before async actions

This commit is contained in:
Adomas Venčkauskas 2026-08-07 07:23:01 +00:00
parent 80b82fc953
commit ad90d4b76f

View file

@ -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);