Browse Source

fix: Remove local elements when there is room data during `startCollaboration` (#9786)

* Remove local elements when there is room data

* Update excalidraw-app/collab/Collab.tsx

---------

Co-authored-by: David Luzar <[email protected]>
Omar Brikaa 1 month ago
parent
commit
00ae455873
1 changed files with 4 additions and 1 deletions
  1. 4 1
      excalidraw-app/collab/Collab.tsx

+ 4 - 1
excalidraw-app/collab/Collab.tsx

@@ -530,7 +530,10 @@ class Collab extends PureComponent<CollabProps, CollabState> {
       return null;
     }
 
-    if (!existingRoomLinkData) {
+    if (existingRoomLinkData) {
+      // when joining existing room, don't merge it with current scene data
+      this.excalidrawAPI.resetScene();
+    } else {
       const elements = this.excalidrawAPI.getSceneElements().map((element) => {
         if (isImageElement(element) && element.status === "saved") {
           return newElementWith(element, { status: "pending" });