From 623788c2db8a2c76fde08ed15b4067200dccac32 Mon Sep 17 00:00:00 2001 From: David Sheldrick Date: Thu, 2 May 2024 14:54:41 +0100 Subject: [PATCH] Fix viewport following (#3681) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was my bad after refactoring how the viewport following stuff used store queries. ### Change Type - [x] `sdk` — Changes the tldraw SDK - [ ] `dotcom` — Changes the tldraw.com web app - [ ] `docs` — Changes to the documentation, examples, or templates. - [ ] `vs code` — Changes to the vscode plugin - [ ] `internal` — Does not affect user-facing stuff - [x] `bugfix` — Bug fix - [ ] `feature` — New feature - [ ] `improvement` — Improving existing features - [ ] `chore` — Updating dependencies, other boring stuff - [ ] `galaxy brain` — Architectural changes - [ ] `tests` — Changes to any test code - [ ] `tools` — Changes to infrastructure, CI, internal scripts, debugging tools, etc. - [ ] `dunno` — I don't know ### Test Plan 1. Add a step-by-step description of how to test your PR here. 2. - [ ] Unit Tests - [ ] End to end tests ### Release Notes - Fixes an issue where viewport following was not working --- packages/editor/src/lib/editor/Editor.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/editor/src/lib/editor/Editor.ts b/packages/editor/src/lib/editor/Editor.ts index d205a368d..e260a8709 100644 --- a/packages/editor/src/lib/editor/Editor.ts +++ b/packages/editor/src/lib/editor/Editor.ts @@ -2919,7 +2919,9 @@ export class Editor extends EventEmitter { const moveTowardsUser = () => { // Stop following if we can't find the user - const leaderPresence = [...leaderPresences] + const leaderPresence = this._getCollaboratorsQuery() + .get() + .filter((p) => p.userId === userId) .sort((a, b) => { return a.lastActivityTimestamp - b.lastActivityTimestamp })