www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit e44dcb1bb4f8fb689b9bd1f9b93e40c1c83db33d
parent 0726ace6e9fa4caa567e11448a3819267c72bb45
Author: Simon Kornblith <simon@simonster.com>
Date:   Thu,  3 Jun 2010 22:30:32 +0000

fix excessive processCitationCluster calls


Diffstat:
Mchrome/content/zotero/xpcom/integration.js | 23+++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/chrome/content/zotero/xpcom/integration.js b/chrome/content/zotero/xpcom/integration.js @@ -1331,24 +1331,25 @@ Zotero.Integration.Session.prototype.formatCitation = function(index, citation) * Updates the list of citations to be serialized to the document */ Zotero.Integration.Session.prototype.updateCitations = function(force) { + var allUpdatesForced = false; var forcedUpdates = {}; if(force) { + allUpdatesForced = true; // make sure at least one citation gets updated - var haveUpdates = false; - updateLoop: for each(var indexList in [this.newIndices, this.updateIndices]) { for(var i in indexList) { if(!this.citationsByIndex[i].properties.delete) { - haveUpdates = true; + allUpdatesForced = false; break updateLoop; } } } - if(!haveUpdates) { + if(allUpdatesForced) { for(i in this.citationsByIndex) { if(this.citationsByIndex[i] && !this.citationsByIndex[i].properties.delete) { forcedUpdates[i] = true; + break; } } } @@ -1358,7 +1359,8 @@ Zotero.Integration.Session.prototype.updateCitations = function(force) { Zotero.debug([key for(key in this.newIndices)]); Zotero.debug("Zotero.Integration: indices of updated citations"); Zotero.debug([key for(key in this.updateIndices)]); - + Zotero.debug("Zotero.Integration: indices of forcedUpdates"); + Zotero.debug([key for(key in forcedUpdates)]); var deleteCitations = []; for each(var indexList in [this.newIndices, this.updateIndices, forcedUpdates]) { @@ -1380,6 +1382,11 @@ Zotero.Integration.Session.prototype.updateCitations = function(force) { } } + if(allUpdatesForced) { + this.newIndices = {}; + this.updateIndices = {}; + } + return deleteCitations; } @@ -1492,9 +1499,9 @@ Zotero.Integration.Session.prototype.previewCitation = function(citation) { throw e; } - var citationText = this.citationText[citation.properties.index]; - delete this.citationText[citation.properties.index]; - return citationText; + // we don't delete the citationText only because the add citation dialog always calls + // previewCitation before returning + return this.citationText[citation.properties.index]; } /**