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}`