From ecf04769393af9b092de07b9ab704bc423f8feb5 Mon Sep 17 00:00:00 2001 From: moklick Date: Tue, 23 Aug 2022 18:09:57 +0200 Subject: [PATCH] fix(edges): use default type if type is invalid --- packages/core/src/container/EdgeRenderer/index.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/core/src/container/EdgeRenderer/index.tsx b/packages/core/src/container/EdgeRenderer/index.tsx index 98b4e947..4b51658b 100644 --- a/packages/core/src/container/EdgeRenderer/index.tsx +++ b/packages/core/src/container/EdgeRenderer/index.tsx @@ -99,7 +99,16 @@ const EdgeRenderer = (props: EdgeRendererProps) => { return null; } - const edgeType = edge.type || 'default'; + let edgeType = edge.type || 'default'; + + if (!props.edgeTypes[edgeType]) { + devWarn( + `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 =