From 75bd395669ed2c61b6e6dd0c666e2ea099c07a70 Mon Sep 17 00:00:00 2001 From: zadam Date: Sat, 30 May 2020 22:35:18 +0200 Subject: [PATCH] fix extra refresh because of duplicated sync event, closes #1063 --- src/public/app/services/ws.js | 4 ++++ src/services/notes.js | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/public/app/services/ws.js b/src/public/app/services/ws.js index 3ddb70bc9..4e1e36302 100644 --- a/src/public/app/services/ws.js +++ b/src/public/app/services/ws.js @@ -165,6 +165,10 @@ async function consumeSyncData() { utils.reloadApp(); } + for (const syncRow of nonProcessedSyncRows) { + processedSyncIds.add(syncRow.id); + } + lastProcessedSyncId = Math.max(lastProcessedSyncId, allSyncRows[allSyncRows.length - 1].id); } diff --git a/src/services/notes.js b/src/services/notes.js index a04164ef5..3fa001c12 100644 --- a/src/services/notes.js +++ b/src/services/notes.js @@ -662,7 +662,9 @@ async function scanForLinks(note) { const content = await note.getContent(); const newContent = await saveLinks(note, content); - await note.setContent(newContent); + if (content !== newContent) { + await note.setContent(newContent); + } } catch (e) { log.error(`Could not scan for links note ${note.noteId}: ${e.message} ${e.stack}`);