Load item data in feed libraries before refreshing feeds

This commit is contained in:
Dan Stillman 2016-04-26 00:00:12 -04:00
parent a8e94a8cba
commit 55688a8104
3 changed files with 6 additions and 1 deletions

View file

@ -204,6 +204,7 @@ Zotero.Feeds = new function() {
Zotero.debug("Running update for feeds: " + needUpdate.join(', '));
for (let i=0; i<needUpdate.length; i++) {
let feed = Zotero.Feeds.get(needUpdate[i]);
yield feed.waitForDataLoad('item');
yield feed._updateFeed();
}

View file

@ -371,6 +371,9 @@ Zotero.Library.prototype.setDataLoaded = function (objectType) {
this._dataLoadedDeferreds[objectType].resolve();
};
/**
* Wait for a given data type to load, loading it now if necessary
*/
Zotero.Library.prototype.waitForDataLoad = Zotero.Promise.coroutine(function* (objectType) {
if (this.getDataLoaded(objectType)) return;

View file

@ -631,7 +631,8 @@ Components.utils.import("resource://gre/modules/osfile.jsm");
yield Zotero.Relations.init();
yield Zotero.Feeds.init();
// Load all library data except for items
// Load all library data except for items, which are loaded when libraries are first
// clicked on or if otherwise necessary
yield Zotero.Promise.each(
Zotero.Libraries.getAll(),
library => Zotero.Promise.coroutine(function* () {