From d77eee291cb11c636f0d8367f78ce64e5267b6b9 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Thu, 9 Nov 2023 17:28:23 +0000 Subject: [PATCH] Initial commit --- core/modules/syncer.js | 51 +++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/core/modules/syncer.js b/core/modules/syncer.js index c06fcb143..f5c5f2a41 100644 --- a/core/modules/syncer.js +++ b/core/modules/syncer.js @@ -187,6 +187,7 @@ Syncer.prototype.readTiddlerInfo = function() { // Record information for known tiddlers var self = this, tiddlers = this.getSyncedTiddlers(); + this.logger.log("Initialising tiddlerInfo for " + tiddlers.length + " tiddlers"); $tw.utils.each(tiddlers,function(title) { var tiddler = self.wiki.getTiddler(title); if(tiddler) { @@ -203,33 +204,38 @@ Syncer.prototype.readTiddlerInfo = function() { Checks whether the wiki is dirty (ie the window shouldn't be closed) */ Syncer.prototype.isDirty = function() { - this.logger.log("Checking dirty status"); - // Check tiddlers that are in the store and included in the filter function - var titles = this.getSyncedTiddlers(); - for(var index=0; index tiddlerInfo.changeCount) { + var self = this; + function checkIsDirty() { + // Check tiddlers that are in the store and included in the filter function + var titles = self.getSyncedTiddlers(); + for(var index=0; index tiddlerInfo.changeCount) { + return true; + } + } else { + // If the tiddler isn't known on the server then it needs to be saved to the server return true; } - } else { - // If the tiddler isn't known on the server then it needs to be saved to the server + } + } + // Check tiddlers that are known from the server but not currently in the store + titles = Object.keys(self.tiddlerInfo); + for(index=0; index