refactor(reactflowUtils.ts): extract duplicated code into a helper function to improve readability and maintainability

fix(reactflowUtils.ts): fix typo in function name scapedJSONStringfy to escapedJSONStringify
fix(reactflowUtils.ts): fix typo in function name customStringify to escapedJSONStringify
feat(reactflowUtils.ts): add inputTypes property to targetHandleType to improve functionality and accuracy of handle connection check
This commit is contained in:
anovazzi1 2023-09-18 18:21:09 -03:00
commit 3305983cc4
2 changed files with 302 additions and 299 deletions

File diff suppressed because it is too large Load diff

View file

@ -589,17 +589,19 @@ function isHandleConnected(
/*
this function receives a flow and a handleId and check if there is a connection with this handle
*/
scapedJSONStringfy({ type: field.type, fieldName: key, id: nodeId })
if (field.proxy) {
if (
edges.some(
(e) =>
e.targetHandle ===
customStringify({
scapedJSONStringfy({
type: field.type,
fieldName: key,
id: nodeId,
proxy: { id: field.proxy!.id, field: field.proxy!.field },
})
inputTypes: field.input_types,
} as targetHandleType)
)
) {
return true;
@ -609,7 +611,9 @@ function isHandleConnected(
edges.some(
(e) =>
e.targetHandle ===
customStringify({ type: field.type, fieldName: key, id: nodeId })
scapedJSONStringfy({ type: field.type, fieldName: key,
id: nodeId,
inputTypes:field.input_types} as targetHandleType)
)
) {
return true;