diff --git a/frontend/sync-client/src/persistence/database.ts b/frontend/sync-client/src/persistence/database.ts index 658596ef..d42651ae 100644 --- a/frontend/sync-client/src/persistence/database.ts +++ b/frontend/sync-client/src/persistence/database.ts @@ -198,6 +198,9 @@ export class Database { relativePath: RelativePath, promise: Promise ): DocumentRecord { + this.logger.debug( + `Creating new pending document: ${relativePath} (${documentId})` + ); const previousEntry = this.getLatestDocumentByRelativePath(relativePath); diff --git a/frontend/sync-client/src/services/websocket-manager.ts b/frontend/sync-client/src/services/websocket-manager.ts index 08442290..015a778e 100644 --- a/frontend/sync-client/src/services/websocket-manager.ts +++ b/frontend/sync-client/src/services/websocket-manager.ts @@ -282,13 +282,10 @@ export class WebSocketManager { this.logger.debug( `Received cursor positions for ${JSON.stringify(message.clients)}` ); - const filteredClients = message.clients.filter( - (client) => client.deviceId !== this.deviceId - ); await awaitAll( this.remoteCursorsUpdateListeners.map(async (listener) => { - await listener(filteredClients).catch((error: unknown) => { + await listener(message.clients).catch((error: unknown) => { this.logger.error( `Error in cursor positions listener: ${String(error)}` ); diff --git a/frontend/sync-client/src/sync-operations/unrestricted-syncer.ts b/frontend/sync-client/src/sync-operations/unrestricted-syncer.ts index 4e4243cc..cf94c48a 100644 --- a/frontend/sync-client/src/sync-operations/unrestricted-syncer.ts +++ b/frontend/sync-client/src/sync-operations/unrestricted-syncer.ts @@ -69,19 +69,18 @@ export class UnrestrictedSyncer { }; return this.executeSync(updateDetails, async () => { + const originalRelativePath = document.relativePath; if (document.isDeleted) { this.logger.debug( - `Document ${document.relativePath} has been already deleted, no need to create it` + `Document ${originalRelativePath} has been already deleted, no need to create it` ); return; } - const contentBytes = await this.operations.read( - document.relativePath - ); // this can throw FileNotFoundError + const contentBytes = + await this.operations.read(originalRelativePath); // this can throw FileNotFoundError const contentHash = hash(contentBytes); - const originalRelativePath = document.relativePath; const response = await this.syncService.create({ documentId: document.documentId, relativePath: originalRelativePath, @@ -99,6 +98,9 @@ export class UnrestrictedSyncer { // In case a document with the same name (but different ID) had existed remotely that we haven't known about if (response.relativePath != originalRelativePath) { + this.logger.debug( + `Document ${originalRelativePath} has been created remotely at a different path: ${response.relativePath}, moving it locally` + ); await this.operations.move( document.relativePath, response.relativePath