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/
This commit is contained in:
Dan Stillman 2026-10-12 15:56:22 -04:00
parent 44fe83d98b
commit 3378fc94f0

View file

@ -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,
);
}
/**