mirror of
https://github.com/zotero/zotero.git
synced 2026-10-05 02:43:38 +00:00
Add Zotero.startupSyncPromise
Resolves after initial auto-sync completes or after the initial auto-sync would run if disabled
This commit is contained in:
parent
4d7a099c32
commit
a5843d8e2d
2 changed files with 12 additions and 1 deletions
|
|
@ -205,6 +205,8 @@ const { CommandLineOptions } = ChromeUtils.importESModule("chrome://zotero/conte
|
|||
this.uiReadyPromise.then(() => {
|
||||
Zotero.debug("User interface ready in " + (new Date() - _startupTime) + " ms");
|
||||
});
|
||||
this.startupSyncDeferred = Zotero.Promise.defer();
|
||||
this.startupSyncPromise = this.startupSyncDeferred.promise;
|
||||
|
||||
if (options) {
|
||||
let opts = [
|
||||
|
|
|
|||
|
|
@ -862,6 +862,7 @@ var ZoteroPane = new function () {
|
|||
}
|
||||
|
||||
// Auto-sync on pane open or if new account
|
||||
let startupSync = false;
|
||||
if (Zotero.Prefs.get('sync.autoSync') || Zotero.initAutoSync) {
|
||||
await Zotero.proxyAuthComplete;
|
||||
await Zotero.uiReadyPromise;
|
||||
|
|
@ -879,11 +880,19 @@ var ZoteroPane = new function () {
|
|||
Zotero.debug('Firefox profile access error -- skipping initial auto-sync', 4);
|
||||
}
|
||||
else {
|
||||
startupSync = true;
|
||||
Zotero.Sync.Runner.sync({
|
||||
background: true
|
||||
}).then(() => Zotero.initAutoSync = false);
|
||||
})
|
||||
.then(() => {
|
||||
Zotero.initAutoSync = false;
|
||||
Zotero.startupSyncDeferred.resolve();
|
||||
});
|
||||
}
|
||||
}
|
||||
if (!startupSync) {
|
||||
Zotero.startupSyncDeferred.resolve();
|
||||
}
|
||||
|
||||
// Set sync icon to spinning if there's an existing sync
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue