From 915bda9fd8d23030cdd3bfcbda3ebd57bf3e1c44 Mon Sep 17 00:00:00 2001 From: David Luzar Date: Mon, 26 Oct 2020 15:45:51 +0100 Subject: [PATCH] restore elements on load from firebase (#2269) --- src/data/firebase.ts | 4 ++-- src/data/restore.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/data/firebase.ts b/src/data/firebase.ts index e97044ad..1451db08 100644 --- a/src/data/firebase.ts +++ b/src/data/firebase.ts @@ -2,6 +2,7 @@ import { createIV, getImportedKey } from "./index"; import { ExcalidrawElement } from "../element/types"; import { getSceneVersion } from "../element"; import Portal from "../components/Portal"; +import { restoreElements } from "./restore"; let firebasePromise: Promise | null = null; @@ -155,6 +156,5 @@ export async function loadFromFirebase( const storedScene = doc.data() as FirebaseStoredScene; const ciphertext = storedScene.ciphertext.toUint8Array(); const iv = storedScene.iv.toUint8Array(); - const plaintext = await decryptElements(roomKey, iv, ciphertext); - return plaintext; + return restoreElements(await decryptElements(roomKey, iv, ciphertext)); } diff --git a/src/data/restore.ts b/src/data/restore.ts index 9d352746..a6913193 100644 --- a/src/data/restore.ts +++ b/src/data/restore.ts @@ -35,7 +35,7 @@ const restoreElementWithProperties = ( // newly added elements version: element.version || 1, versionNonce: element.versionNonce ?? 0, - isDeleted: false, + isDeleted: element.isDeleted ?? false, id: element.id || randomId(), fillStyle: element.fillStyle || "hachure", strokeWidth: element.strokeWidth || 1,