diff --git a/packages/builder/src/components/design/AppPreview/ComponentSelectionList.svelte b/packages/builder/src/components/design/AppPreview/ComponentSelectionList.svelte index 97677b3ca5..0fd334794a 100644 --- a/packages/builder/src/components/design/AppPreview/ComponentSelectionList.svelte +++ b/packages/builder/src/components/design/AppPreview/ComponentSelectionList.svelte @@ -32,11 +32,8 @@ return enrichedStructure } - const onItemChosen = async (item, idx) => { - if (item.isCategory) { - // Select and open this category - selectedIndex = idx - } else { + const onItemChosen = async (item) => { + if (!item.isCategory) { // Add this component await store.actions.components.create(item.component) } @@ -44,15 +41,14 @@ - {#each enrichedStructure as item, idx} + {#each enrichedStructure as item} onItemChosen(item, idx)} + slot="control" + on:click={() => onItemChosen(item)} > {item.name}