Skip to content

Commit c291af0

Browse files
committed
fix(app-page-builder): render null if element is not available
1 parent 654ed20 commit c291af0

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

packages/app-page-builder/src/editor/contexts/EditorPageElementsProvider/ElementControlHorizontalDropZones.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ export const ElementControlHorizontalDropZones = () => {
8989
const { showSnackbar } = useSnackbar();
9090
const parentType = meta.parentElement.type;
9191

92-
const { type } = element;
93-
9492
const canDrop = (item: DragObjectWithTypeWithTarget) => {
9593
if (!item) {
9694
return false;
@@ -129,7 +127,7 @@ export const ElementControlHorizontalDropZones = () => {
129127
);
130128
};
131129

132-
if (!isDragging) {
130+
if (!isDragging || !element) {
133131
return null;
134132
}
135133

@@ -142,7 +140,7 @@ export const ElementControlHorizontalDropZones = () => {
142140
<Droppable
143141
isVisible={({ item }) => canDrop(item)}
144142
onDrop={source => dropElementAction(source, meta.elementIndex)}
145-
type={type}
143+
type={element.type}
146144
>
147145
{({ drop, isOver }) => (
148146
<WrapperDroppable ref={drop} below={false} zIndex={zIndex}>
@@ -156,7 +154,7 @@ export const ElementControlHorizontalDropZones = () => {
156154
<Droppable
157155
isVisible={({ item }) => canDrop(item)}
158156
onDrop={source => dropElementAction(source, meta.elementIndex + 1)}
159-
type={type}
157+
type={element.type}
160158
>
161159
{({ drop, isOver }) => (
162160
<WrapperDroppable ref={drop} below zIndex={zIndex}>

0 commit comments

Comments
 (0)