🐛 fix(utils.ts): add optional chaining to reactFlowInstance.getNode() to handle cases where reactFlowInstance is null or undefined

This commit is contained in:
Cristhian Zanforlin Lousa 2023-07-10 16:41:23 -03:00
commit 5d42acf28d

View file

@ -598,7 +598,7 @@ export function isValidConnection(
) || ) ||
targetHandle.split("|")[0] === "str" targetHandle.split("|")[0] === "str"
) { ) {
let targetNode = reactFlowInstance.getNode(target).data.node; let targetNode = reactFlowInstance?.getNode(target)?.data?.node;
if (!targetNode) { if (!targetNode) {
if ( if (
!reactFlowInstance !reactFlowInstance