refactor(renderer): show error when no width or height is set #196
This commit is contained in:
@@ -89,6 +89,11 @@ const GraphView = memo(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const size = getDimensions(rendererNode.current);
|
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);
|
updateSize(size);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ export interface ReactFlowProps extends Omit<HTMLAttributes<HTMLDivElement>, 'on
|
|||||||
const ReactFlow = ({
|
const ReactFlow = ({
|
||||||
style,
|
style,
|
||||||
onElementClick,
|
onElementClick,
|
||||||
elements,
|
elements = [],
|
||||||
children,
|
children,
|
||||||
nodeTypes,
|
nodeTypes,
|
||||||
edgeTypes,
|
edgeTypes,
|
||||||
|
|||||||
Reference in New Issue
Block a user