mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-09 05:26:24 +09:00
Fix dragging when navigator is docked (#1586)
Fixed conditional rendering of tree preview. ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 5de6) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio-builder/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env.example` and the `builder/env-check.js` if mandatory Co-authored-by: Oleg Isonen <oleg008@gmail.com>
This commit is contained in:
1 parent
1f908d1abf
commit
fd4e2a4f4b
1 file changed
+3
-11
@@ -36,18 +36,10 @@ const contentStyle = {
|
||||
overflow: "auto",
|
||||
};
|
||||
|
||||
// separate component to avoid inspetor updates on drag when navigator is undocked
|
||||
const NavigatorTreePreview = () => {
|
||||
const [dragAndDropState] = useDragAndDropState();
|
||||
if (dragAndDropState.isDragging) {
|
||||
return <NavigatorTree />;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
export const Inspector = ({ publish, navigatorLayout }: InspectorProps) => {
|
||||
const selectedInstance = useStore(selectedInstanceStore);
|
||||
const tabsRef = useRef<HTMLDivElement>(null);
|
||||
const [dragAndDropState] = useDragAndDropState();
|
||||
|
||||
const [tab, setTab] = useState("style");
|
||||
|
||||
@@ -59,8 +51,8 @@ export const Inspector = ({ publish, navigatorLayout }: InspectorProps) => {
|
||||
}
|
||||
}, [selectedInstance, tab]);
|
||||
|
||||
if (navigatorLayout === "docked") {
|
||||
return <NavigatorTreePreview />;
|
||||
if (navigatorLayout === "docked" && dragAndDropState.isDragging) {
|
||||
return <NavigatorTree />;
|
||||
}
|
||||
|
||||
if (selectedInstance === undefined) {
|
||||
|
||||
Reference in new issue
Block a user