From 3378fc94f0a4cecfd149396b4e27252f486a20ba Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 12 Oct 2026 15:56:22 -0400 Subject: [PATCH] Don't open a DB transaction when plugins register or refresh UI elements The transaction didn't do any database work, but sync and other transactions had to wait for it to finish, so an observer that never returned could leave startup sync stuck at "Waiting for other operations to finish". https://forums.zotero.org/discussion/134185/ --- .../zotero/xpcom/pluginAPI/pluginAPIBase.mjs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/chrome/content/zotero/xpcom/pluginAPI/pluginAPIBase.mjs b/chrome/content/zotero/xpcom/pluginAPI/pluginAPIBase.mjs index 15aa11e7c8..dc11e32467 100644 --- a/chrome/content/zotero/xpcom/pluginAPI/pluginAPIBase.mjs +++ b/chrome/content/zotero/xpcom/pluginAPI/pluginAPIBase.mjs @@ -327,14 +327,16 @@ class PluginAPIBase { return; } this._lastUpdateID = this._generateRandomKey(); - await lazy.Zotero.DB.executeTransaction(async () => { - lazy.Zotero.Notifier.queue( - this._config.notifyAction, - this._config.notifyType, - ids, - extraData, - ); - }); + // register(), unregister(), and refresh() call _refresh() without awaiting it, so yield + // first to keep observers -- and the plugin hooks they call -- from running before those + // calls return + await Promise.resolve(); + await lazy.Zotero.Notifier.trigger( + this._config.notifyAction, + this._config.notifyType, + ids, + extraData, + ); } /**