Skip to content

Commit

Permalink
fix no insertion target false error (#5771)
Browse files Browse the repository at this point in the history
  • Loading branch information
liady authored May 28, 2024
1 parent 07c462b commit 8068dba
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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<EditorAction> => {
if (elementWithoutUID.type === 'JSX_ELEMENT') {
Expand Down Expand Up @@ -744,7 +744,7 @@ const ComponentPickerContextMenuSimple = React.memo<ComponentPickerContextMenuPr
const showFullMenu = useCreateCallbackToShowComponentPicker()(targets, insertionTarget, 'full')

// for insertion we currently only support one target
const firstTarget = EP.getFirstPath(targets)
const firstTarget = targets[0]
const preferredChildren = usePreferredChildrenForTarget(firstTarget, insertionTarget)

const dispatch = useDispatch()
Expand Down Expand Up @@ -803,7 +803,7 @@ const ComponentPickerContextMenuSimple = React.memo<ComponentPickerContextMenuPr
const ComponentPickerContextMenuFull = React.memo<ComponentPickerContextMenuProps>(
({ 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),
Expand Down

0 comments on commit 8068dba

Please sign in to comment.