From 41ffba8ec2d5418c81e922818a8709a4e3e2925f Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Fri, 3 Jan 2025 18:22:37 +0000 Subject: [PATCH] Only make last seen update go forwards --- .../src/sync-operations/apply-remote-changes-locally.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugin/src/sync-operations/apply-remote-changes-locally.ts b/plugin/src/sync-operations/apply-remote-changes-locally.ts index d1a8f69..0146463 100644 --- a/plugin/src/sync-operations/apply-remote-changes-locally.ts +++ b/plugin/src/sync-operations/apply-remote-changes-locally.ts @@ -44,7 +44,13 @@ export async function applyRemoteChangesLocally({ ) ); - await database.setLastSeenUpdateId(remote.lastUpdateId); + const lastSeenUpdateId = database.getLastSeenUpdateId(); + if ( + lastSeenUpdateId === undefined || + remote.lastUpdateId > lastSeenUpdateId + ) { + await database.setLastSeenUpdateId(remote.lastUpdateId); + } } catch (e) { Logger.getInstance().error( `Failed to apply remote changes locally: ${e}`