From b79ef0d428699adcf030f5fe00f17f4dc22cb67b Mon Sep 17 00:00:00 2001 From: David Luzar Date: Fri, 5 Feb 2021 12:04:33 +0100 Subject: [PATCH] fix: don't prompt on empty scenes (#2937) --- src/excalidraw-app/index.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/excalidraw-app/index.tsx b/src/excalidraw-app/index.tsx index 32187ec8..55079c86 100644 --- a/src/excalidraw-app/index.tsx +++ b/src/excalidraw-app/index.tsx @@ -80,7 +80,14 @@ const initializeScene = async (opts: { let roomLinkData = getCollaborationLinkData(window.location.href); const isExternalScene = !!(id || jsonMatch || roomLinkData); if (isExternalScene) { - if (roomLinkData || window.confirm(t("alerts.loadSceneOverridePrompt"))) { + if ( + // don't prompt if scene is empty + !scene.elements.length || + // don't prompt for collab scenes because we don't override local storage + roomLinkData || + // otherwise, prompt whether user wants to override current scene + window.confirm(t("alerts.loadSceneOverridePrompt")) + ) { // Backwards compatibility with legacy url format if (id) { scene = await loadScene(id, null, initialData);