Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

Fix drop target when sort navigator tree (#1323)

Bogdan Chadkin21c526152988
diff --git a/packages/design-system/src/components/tree/tree.tsx b/packages/design-system/src/components/tree/tree.tsx
index 60ad2f62c8..077182bac6 100644
--- a/packages/design-system/src/components/tree/tree.tsx
+++ b/packages/design-system/src/components/tree/tree.tsx
@@ -158,7 +158,7 @@ export const Tree = <Data extends { id: string }>({
return dropTarget;
}
- const newDropItemSelector = dropTarget.data.slice();
+ let newDropItemSelector = dropTarget.data.slice();
if (dropTarget.area === "top" || dropTarget.area === "bottom") {
newDropItemSelector.shift();
@@ -178,7 +178,7 @@ export const Tree = <Data extends { id: string }>({
if (ancestorIndex === -1) {
return getFallbackDropTarget();
}
- newDropItemSelector.slice(ancestorIndex);
+ newDropItemSelector = newDropItemSelector.slice(ancestorIndex);
const element = getElementByItemSelector(
rootRef.current ?? undefined,