diff --git a/src/container/GraphView/index.tsx b/src/container/GraphView/index.tsx index aa78cef8..3423c334 100644 --- a/src/container/GraphView/index.tsx +++ b/src/container/GraphView/index.tsx @@ -89,6 +89,11 @@ const GraphView = memo( } const size = getDimensions(rendererNode.current); + + if (size.height === 0 || size.width === 0) { + throw new Error('The React Flow parent container needs a width and a height to render the graph.'); + } + updateSize(size); }; diff --git a/src/container/ReactFlow/index.tsx b/src/container/ReactFlow/index.tsx index d7c86841..371a0deb 100644 --- a/src/container/ReactFlow/index.tsx +++ b/src/container/ReactFlow/index.tsx @@ -49,7 +49,7 @@ export interface ReactFlowProps extends Omit, 'on const ReactFlow = ({ style, onElementClick, - elements, + elements = [], children, nodeTypes, edgeTypes,