Syncer should only save existing tiddlers if they have changed

This commit is contained in:
Jeremy Ruston 2024-04-16 11:59:52 +01:00
parent cc4cb04900
commit db9978f8c2
1 changed files with 5 additions and 1 deletions

View File

@ -257,7 +257,11 @@ Save an incoming tiddler in the store, and updates the associated tiddlerInfo
Syncer.prototype.storeTiddler = function(tiddlerFields) {
// Save the tiddler
var tiddler = new $tw.Tiddler(tiddlerFields);
this.wiki.addTiddler(tiddler);
// Only save the tiddler if it has changed
var existingTiddler = this.wiki.getTiddler(tiddlerFields.title);
if(!existingTiddler || !existingTiddler.isEqual(tiddler)) {
this.wiki.addTiddler(tiddler);
}
// Save the tiddler revision and changeCount details
this.tiddlerInfo[tiddlerFields.title] = {
revision: this.getTiddlerRevision(tiddlerFields.title),