From a34003930110927794b5d6397ed941b55633cba2 Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Sun, 25 May 2025 09:57:22 +0100 Subject: [PATCH] Remove double-delete notifications --- frontend/sync-client/src/sync-operations/syncer.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/frontend/sync-client/src/sync-operations/syncer.ts b/frontend/sync-client/src/sync-operations/syncer.ts index 20e50120..7b4ce461 100644 --- a/frontend/sync-client/src/sync-operations/syncer.ts +++ b/frontend/sync-client/src/sync-operations/syncer.ts @@ -155,6 +155,18 @@ export class Syncer { public async syncLocallyDeletedFile( relativePath: RelativePath ): Promise { + if ( + this.database.getLatestDocumentByRelativePath(relativePath) + ?.isDeleted === true + ) { + // This is must be a consequence of us deleting a file because of a remote update + // which triggered a local delete, so we don't need to do anything here. + this.logger.debug( + `Document ${relativePath} has already been markes as deleted, skipping` + ); + return; + } + // We have to have a record of the delete in case there's an in-flight update for the same // document which finishes after the delete has succeeded and would introduce a phantom metadata record. this.database.delete(relativePath);