refactor(renderer): show error when no width or height is set #196

This commit is contained in:
moklick
2020-05-11 18:50:09 +02:00
parent 7a2bff2502
commit 6dcb9f5120
2 changed files with 6 additions and 1 deletions
+5
View File
@@ -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);
};
+1 -1
View File
@@ -49,7 +49,7 @@ export interface ReactFlowProps extends Omit<HTMLAttributes<HTMLDivElement>, 'on
const ReactFlow = ({
style,
onElementClick,
elements,
elements = [],
children,
nodeTypes,
edgeTypes,