From 8068dbaec7d70fa9557b38a4878611477f92d666 Mon Sep 17 00:00:00 2001 From: Liad Yosef Date: Tue, 28 May 2024 17:54:42 +0300 Subject: [PATCH] fix no insertion target false error (#5771) --- .../navigator-item/component-picker-context-menu.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/editor/src/components/navigator/navigator-item/component-picker-context-menu.tsx b/editor/src/components/navigator/navigator-item/component-picker-context-menu.tsx index 809ab19b431c..6b5b3802eb93 100644 --- a/editor/src/components/navigator/navigator-item/component-picker-context-menu.tsx +++ b/editor/src/components/navigator/navigator-item/component-picker-context-menu.tsx @@ -344,7 +344,7 @@ export const useCreateCallbackToShowComponentPicker = // for insertion and replacement we still don't support multiple selection // so we pick the first one targets = selectedViews.slice(0, 1) - const firstTarget = EP.getFirstPath(targets) + const firstTarget = targets[0] const targetParent = isReplaceTarget(insertionTarget) || isReplaceKeepChildrenAndStyleTarget(insertionTarget) @@ -478,7 +478,7 @@ function insertComponentPickerItem( const uid = generateConsistentUID('prop', uniqueIds) const elementWithoutUID = toInsert.element() // TODO: for most of the operations we still only support one target - const firstTarget = EP.getFirstPath(targets) + const firstTarget = targets[0] const actions = ((): Array => { if (elementWithoutUID.type === 'JSX_ELEMENT') { @@ -744,7 +744,7 @@ const ComponentPickerContextMenuSimple = React.memo( ({ targets, insertionTarget }) => { // for insertion we currently only support one target - const firstTarget = EP.getFirstPath(targets) + const firstTarget = targets[0] const targetChildren = useEditorState( Substores.metadata, (store) => MetadataUtils.getChildrenUnordered(store.editor.jsxMetadata, firstTarget),