diff --git a/src/components/graph/BaseNode.tsx b/src/components/graph/BaseNode.tsx index bb4631b..dc1301b 100644 --- a/src/components/graph/BaseNode.tsx +++ b/src/components/graph/BaseNode.tsx @@ -1,6 +1,5 @@ import type { ComponentProps, ReactNode } from "react"; import { NodeResizeControl } from "@xyflow/react"; -import { Expand } from "lucide-react"; import { cn } from "@/lib/utils"; @@ -11,20 +10,38 @@ export type BaseNodeProps = ComponentProps<"div"> & { nodeId?: string; /** Connection handles (InputHandle, OutputHandle). Rendered outside the overflow layer so they stay visible. */ handles?: ReactNode; + /** When provided, node uses this size (e.g. from React Flow width/height). Enables correct resize behavior. */ + dimensions?: { width: number; height: number }; }; export function BaseNode({ className, style, + dimensions, resizable, nodeId, handles, children, ...props }: BaseNodeProps) { - const appliedStyle = style - ? { ...style, display: "flex", flexDirection: "column" as const } - : undefined; + const hasSize = + dimensions && + dimensions.width > 0 && + dimensions.height > 0; + // Don't set overflow: hidden on the root — handles are positioned at left/right -10px + // and would be clipped. The inner content wrapper has overflow-hidden for scrolling. + const appliedStyle = hasSize + ? { + ...style, + width: dimensions.width, + height: dimensions.height, + display: "flex" as const, + flexDirection: "column" as const, + contain: "layout" as const, + } + : style + ? { ...style, display: "flex", flexDirection: "column" as const } + : undefined; return (
@@ -81,9 +83,7 @@ export const FunctionNode = memo(function FunctionNode({ id, data, width, height
- Use in config: prop: ${{id}}
-
prop: {'${'}{id}{'}'}
+