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.

better fix for closing the sidebar tempo

Oleg Isonen199b86fd7ba1
diff --git a/app/designer/features/sidebar-left/sidebar-left.tsx b/app/designer/features/sidebar-left/sidebar-left.tsx
index 1db1ba9b93..bb9716b07d 100644
--- a/app/designer/features/sidebar-left/sidebar-left.tsx
+++ b/app/designer/features/sidebar-left/sidebar-left.tsx
@@ -38,12 +38,14 @@ export const SidebarLeft = ({
const [isDragging, setIsDragging] = useState(false);
const { TabContent } = activeTab === "none" ? none : panels[activeTab];
- const close = useCallback(() => setActiveTab("none"), []);
- useSubscribe<"clickCanvas">("clickCanvas", close);
+ useSubscribe<"clickCanvas">("clickCanvas", () => {
+ setActiveTab("none");
+ });
useSubscribe("dragStartInstance", () => {
- // We can't close the sidebar if we are dragging from the sidebar
- if (isDragging === true) return;
- close();
+ setIsDragging(true);
+ });
+ useSubscribe("dragEndInstance", () => {
+ setIsDragging(false);
});
const handleDragChange = useCallback(
@@ -54,7 +56,7 @@ export const SidebarLeft = ({
setIsDragging(isDragging);
onDragChange(isDragging);
},
- [onDragChange, close]
+ [onDragChange]
);
return (