Skip to content

Commit

Permalink
fix(edge-renderer): fallback to default edge if type is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
moklick committed Sep 14, 2022
1 parent 0891b83 commit 23d1dd0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/container/EdgeRenderer/index.tsx
Expand Up @@ -100,7 +100,16 @@ const EdgeRenderer = (props: EdgeRendererProps) => {
return null;
}

const edgeType = edge.type || 'default';
let edgeType = edge.type || 'default';

if (!props.edgeTypes[edgeType]) {
console.warn(
`[React Flow]: Edge type "${edgeType}" not found. Using fallback type "default". Help: https://reactflow.dev/error#300`
);

edgeType = 'default';
}

const EdgeComponent = props.edgeTypes[edgeType] || props.edgeTypes.default;
// when connection type is loose we can define all handles as sources
const targetNodeHandles =
Expand Down

0 comments on commit 23d1dd0

Please sign in to comment.