fix: removed cleaning edges where input with same type is hidden (#7479)
Removed function that cleaned edges if another input with the same type is hidden
This commit is contained in:
parent
eeb443bdc1
commit
73302a0a1d
1 changed files with 12 additions and 13 deletions
|
|
@ -4,7 +4,7 @@
|
||||||
* This file contains the highest number of commits by Otávio in the entire Langflow project,
|
* This file contains the highest number of commits by Otávio in the entire Langflow project,
|
||||||
* reflecting his unmatched dedication, expertise, and innovative spirit. Each line of code
|
* reflecting his unmatched dedication, expertise, and innovative spirit. Each line of code
|
||||||
* is a testament to his relentless pursuit of excellence and his significant impact on this
|
* is a testament to his relentless pursuit of excellence and his significant impact on this
|
||||||
* project’s evolution.
|
* project's evolution.
|
||||||
|
|
||||||
* His commitment to selflessly helping others embodies the true meaning of open source,
|
* His commitment to selflessly helping others embodies the true meaning of open source,
|
||||||
* and his legacy lives on in each one of his 2771 contributions, inspiring us to build exceptional
|
* and his legacy lives on in each one of his 2771 contributions, inspiring us to build exceptional
|
||||||
|
|
@ -130,10 +130,12 @@ export function cleanEdges(nodes: AllNodeType[], edges: EdgeType[]) {
|
||||||
if (sourceHandle) {
|
if (sourceHandle) {
|
||||||
const parsedSourceHandle = scapeJSONParse(sourceHandle);
|
const parsedSourceHandle = scapeJSONParse(sourceHandle);
|
||||||
const name = parsedSourceHandle.name;
|
const name = parsedSourceHandle.name;
|
||||||
|
|
||||||
if (sourceNode.type == "genericNode") {
|
if (sourceNode.type == "genericNode") {
|
||||||
const output = sourceNode.data.node!.outputs?.find(
|
const output = sourceNode.data.node!.outputs?.find(
|
||||||
(output) => output.name === name,
|
(output) => output.name === name,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (output) {
|
if (output) {
|
||||||
const outputTypes =
|
const outputTypes =
|
||||||
output!.types.length === 1 ? output!.types : [output!.selected!];
|
output!.types.length === 1 ? output!.types : [output!.selected!];
|
||||||
|
|
@ -144,6 +146,7 @@ export function cleanEdges(nodes: AllNodeType[], edges: EdgeType[]) {
|
||||||
output_types: outputTypes,
|
output_types: outputTypes,
|
||||||
dataType: sourceNode.data.type,
|
dataType: sourceNode.data.type,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (scapedJSONStringfy(id) !== sourceHandle) {
|
if (scapedJSONStringfy(id) !== sourceHandle) {
|
||||||
newEdges = newEdges.filter((e) => e.id !== edge.id);
|
newEdges = newEdges.filter((e) => e.id !== edge.id);
|
||||||
}
|
}
|
||||||
|
|
@ -164,20 +167,16 @@ export function filterHiddenFieldsEdges(
|
||||||
targetNode: AllNodeType,
|
targetNode: AllNodeType,
|
||||||
) {
|
) {
|
||||||
if (targetNode) {
|
if (targetNode) {
|
||||||
const nodeInputType = edge.data?.targetHandle?.inputTypes;
|
const targetHandle = edge.data?.targetHandle;
|
||||||
|
if (!targetHandle) return newEdges;
|
||||||
|
|
||||||
|
const fieldName = targetHandle.fieldName;
|
||||||
const nodeTemplates = targetNode.data.node!.template;
|
const nodeTemplates = targetNode.data.node!.template;
|
||||||
|
|
||||||
Object.keys(nodeTemplates).forEach((key) => {
|
// Only check the specific field the edge is connected to
|
||||||
if (!nodeTemplates[key]?.input_types) return;
|
if (nodeTemplates[fieldName]?.show === false) {
|
||||||
if (
|
newEdges = newEdges.filter((e) => e.id !== edge.id);
|
||||||
nodeTemplates[key]?.input_types?.some((type) =>
|
}
|
||||||
nodeInputType?.includes(type),
|
|
||||||
) &&
|
|
||||||
!nodeTemplates[key].show
|
|
||||||
) {
|
|
||||||
newEdges = newEdges.filter((e) => e.id !== edge.id);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return newEdges;
|
return newEdges;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue