chore(warnings): only print for node_env=development

This commit is contained in:
moklick
2022-05-02 14:57:38 +02:00
parent 2e9a203c0e
commit 18be5f1773
6 changed files with 19 additions and 8 deletions
+4 -3
View File
@@ -38,13 +38,14 @@ export function useMarkerSymbol(type: MarkerType) {
const symbol = useMemo(() => {
const symbolExists = MarkerSymbols.hasOwnProperty(type);
if (process.env.NODE_ENV === 'development') {
if (!symbolExists) {
if (!symbolExists) {
// @ts-ignore
if (process.env.NODE_ENV === 'development') {
console.warn(
`[React Flow]: Marker type "${type}" doesn't exist. Help: https://reactflow.dev/error-decoder#900`
);
return () => null;
}
return () => null;
}
return MarkerSymbols[type];
+9 -5
View File
@@ -107,20 +107,24 @@ const EdgeRenderer = (props: EdgeRendererProps) => {
const sourcePosition = sourceHandle?.position || Position.Bottom;
const targetPosition = targetHandle?.position || Position.Top;
if (process.env.NODE_ENV === 'development') {
if (!sourceHandle) {
if (!sourceHandle) {
// @ts-ignore
if (process.env.NODE_ENV === 'development') {
console.warn(
`[React Flow]: Couldn't create edge for source handle id: ${edge.sourceHandle}; edge id: ${edge.id}. Help: https://reactflow.dev/error-decoder#800`
);
return null;
}
return null;
}
if (!targetHandle) {
if (!targetHandle) {
// @ts-ignore
if (process.env.NODE_ENV === 'development') {
console.warn(
`[React Flow]: Couldn't create edge for target handle id: ${edge.targetHandle}; edge id: ${edge.id}. Help: https://reactflow.dev/error-decoder#800`
);
return null;
}
return null;
}
const { sourceX, sourceY, targetX, targetY } = getEdgePositions(