refactor(warnings): only show for node_env=development
This commit is contained in:
@@ -38,9 +38,13 @@ export function useMarkerSymbol(type: MarkerType) {
|
||||
const symbol = useMemo(() => {
|
||||
const symbolExists = MarkerSymbols.hasOwnProperty(type);
|
||||
|
||||
if (!symbolExists) {
|
||||
console.warn(`[React Flow]: Marker type "${type}" doesn't exist. Help: https://reactflow.dev/error-decoder#900`);
|
||||
return () => null;
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
if (!symbolExists) {
|
||||
console.warn(
|
||||
`[React Flow]: Marker type "${type}" doesn't exist. Help: https://reactflow.dev/error-decoder#900`
|
||||
);
|
||||
return () => null;
|
||||
}
|
||||
}
|
||||
|
||||
return MarkerSymbols[type];
|
||||
|
||||
@@ -105,18 +105,20 @@ const EdgeRenderer = (props: EdgeRendererProps) => {
|
||||
const sourcePosition = sourceHandle?.position || Position.Bottom;
|
||||
const targetPosition = targetHandle?.position || Position.Top;
|
||||
|
||||
if (!sourceHandle) {
|
||||
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;
|
||||
}
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
if (!sourceHandle) {
|
||||
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;
|
||||
}
|
||||
|
||||
if (!targetHandle) {
|
||||
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;
|
||||
if (!targetHandle) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
const { sourceX, sourceY, targetX, targetY } = getEdgePositions(
|
||||
|
||||
Reference in New Issue
Block a user