From 62e01a299e1f05227bc6fee4dfc79f9c0f675ad5 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Sat, 13 Aug 2022 15:22:54 +0100 Subject: [PATCH] Fix add component not working on first click when no component is selected --- .../design/[screenId]/_components/AppPreview.svelte | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte index 3c99c90d49..814930d636 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte @@ -186,7 +186,7 @@ $goto("./navigation") } } else if (type === "request-add-component") { - $goto(`./components/${$selectedComponent?._id}/new`) + toggleAddComponent() } else if (type === "highlight-setting") { store.actions.settings.highlight(data.setting) @@ -230,9 +230,8 @@ if (isAddingComponent) { $goto(`../${$selectedScreen._id}/components/${$selectedComponent?._id}`) } else { - $goto( - `../${$selectedScreen._id}/components/${$selectedComponent?._id}/new` - ) + const id = $selectedComponent?._id || $selectedScreen?.props?._id + $goto(`../${$selectedScreen._id}/components/${id}/new`) } }