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);
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ export interface ReactFlowProps extends Omit<HTMLAttributes<HTMLDivElement>, 'on
|
||||
const ReactFlow = ({
|
||||
style,
|
||||
onElementClick,
|
||||
elements,
|
||||
elements = [],
|
||||
children,
|
||||
nodeTypes,
|
||||
edgeTypes,
|
||||
|
||||
Reference in New Issue
Block a user