refactor(warnings): only show for node_env=development

This commit is contained in:
moklick
2022-05-02 14:31:44 +02:00
parent 9331ccc544
commit 2ad60c19a2
6 changed files with 52 additions and 34 deletions
+6 -4
View File
@@ -16,10 +16,12 @@ function useResizeHandler(rendererNode: MutableRefObject<HTMLDivElement | null>)
const size = getDimensions(rendererNode.current);
if (size.height === 0 || size.width === 0) {
console.warn(
'[React Flow]: The React Flow parent container needs a width and a height to render the graph. Help: https://reactflow.dev/error-decoder#400'
);
if (process.env.NODE_ENV === 'development') {
if (size.height === 0 || size.width === 0) {
console.warn(
'[React Flow]: The React Flow parent container needs a width and a height to render the graph. Help: https://reactflow.dev/error-decoder#400'
);
}
}
store.setState({ width: size.width || 500, height: size.height || 500 });