From c462994af909bb888e9f59fe22bb7529df45ccde Mon Sep 17 00:00:00 2001 From: Andras Schmelczer Date: Mon, 25 Aug 2025 16:44:02 +0100 Subject: [PATCH] Improve comments --- frontend/sync-client/src/sync-operations/cursor-tracker.ts | 2 +- scripts/check.sh | 6 +++--- sync-server/src/app_state/websocket/models.rs | 6 +++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/frontend/sync-client/src/sync-operations/cursor-tracker.ts b/frontend/sync-client/src/sync-operations/cursor-tracker.ts index a2233e6a..17f166c4 100644 --- a/frontend/sync-client/src/sync-operations/cursor-tracker.ts +++ b/frontend/sync-client/src/sync-operations/cursor-tracker.ts @@ -149,7 +149,7 @@ export class CursorTracker { public addRemoteCursorsUpdateListener( listener: (cursors: MaybeOutdatedClientCursors[]) => unknown ): void { - // CursorTracker registers its own event listener in the constructor so it must get called first + // CursorTracker registers its own event listener in the constructor so it must have been called before this this.webSocketManager.addRemoteCursorsUpdateListener(async () => { await this.updateLock.withLock(() => listener(this.getRelevantAndPruneKnownClientCursors()) diff --git a/scripts/check.sh b/scripts/check.sh index c75e10c5..f807d2c8 100755 --- a/scripts/check.sh +++ b/scripts/check.sh @@ -9,19 +9,19 @@ cargo fmt --all -- --check cargo machete cargo test --verbose - echo "Running checks in frontend" cd ../frontend npm ci npm run build npm run lint +npm run test + if [[ $(git status --porcelain) ]]; then git status --porcelain echo "Failing CI because the working directory is not clean after linting" exit 1 fi -npm run test -echo "Finished" +echo "Success" cd .. diff --git a/sync-server/src/app_state/websocket/models.rs b/sync-server/src/app_state/websocket/models.rs index 7f1a3073..e037fb7e 100644 --- a/sync-server/src/app_state/websocket/models.rs +++ b/sync-server/src/app_state/websocket/models.rs @@ -23,7 +23,11 @@ pub struct CursorPositionFromClient { #[derive(TS, Serialize, Deserialize, Clone, Debug)] pub struct DocumentWithCursors { - // It's None in case the document is dirty + // It's None in case the document is dirty. + // We still want to sync the cursor to mark + // that it exists and can be client-side + // interpolated. However, the actual + // position is meaningless. #[ts(as = "Option")] pub vault_update_id: Option,