From 127c1be6ada32562a6454cab817bd363c26ade72 Mon Sep 17 00:00:00 2001 From: Christopher Chedeau Date: Sun, 21 Mar 2021 09:25:19 -0700 Subject: [PATCH] fix: Don't scroll to content on INIT websocket message (#3291) If you load a shared scene with at least another person on the scene, you can start seeing the content via the firebase response. If you scroll and you receive the response from the websocket INIT, then it scrolls you back to the center which is jarring. This PR removes the scroll to content for that use case. --- src/excalidraw-app/collab/CollabWrapper.tsx | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/excalidraw-app/collab/CollabWrapper.tsx b/src/excalidraw-app/collab/CollabWrapper.tsx index 0d7a90b8..9b353eb6 100644 --- a/src/excalidraw-app/collab/CollabWrapper.tsx +++ b/src/excalidraw-app/collab/CollabWrapper.tsx @@ -448,15 +448,8 @@ class CollabWrapper extends PureComponent { private handleRemoteSceneUpdate = ( elements: ReconciledElements, - { - init = false, - initFromSnapshot = false, - }: { init?: boolean; initFromSnapshot?: boolean } = {}, + { init = false }: { init?: boolean } = {}, ) => { - if (init || initFromSnapshot) { - this.excalidrawAPI.setScrollToContent(elements); - } - this.excalidrawAPI.updateScene({ elements, commitToHistory: !!init,