Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions GUI/src/components/FlowElementsPopup/PreviousVariables.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@

// Get Endpoints variables
const endpointNodes = previousNodes.filter((node) => node.data.stepType === StepType.UserDefined);
const names = endpointNodes.map((node) => node.data.label?.toString().split(' ')[0]);

Check warning on line 87 in GUI/src/components/FlowElementsPopup/PreviousVariables.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

`names` should be a `Set`, and use `names.has()` to check existence or non-existence.

See more on https://sonarcloud.io/project/issues?id=buerokratt_Service-Module&issues=AZ67lnS84xgqeCd6z3Ro&open=AZ67lnS84xgqeCd6z3Ro&pullRequest=1071
const filteredEndpointsVariables = endpointsVariables.filter((endpoint) => names.includes(endpoint.name));
setEndpoints(filteredEndpointsVariables);

Expand All @@ -109,12 +109,17 @@
key: 'Empty Content Type',
value: stringToTemplate(''),
},
{
id: predefinedInputKeys[1],
key: 'Chat Id',
value: stringToTemplate('chatId'),
},
];

setAssignedVariables([...assignElements, ...predefinedInputElements, ...newAssignElements]);
}, [edges, endpointsVariables, newAssignElements, node.id, nodes]);

function getParentNode(nodes: Node[], edges: Edge[], node: Node): Node | undefined {

Check warning on line 122 in GUI/src/components/FlowElementsPopup/PreviousVariables.tsx

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Move function 'getParentNode' to the outer scope.

See more on https://sonarcloud.io/project/issues?id=buerokratt_Service-Module&issues=AZ67lnS84xgqeCd6z3Rp&open=AZ67lnS84xgqeCd6z3Rp&pullRequest=1071
const parentEdge = edges.findLast((edge) => edge.target === node.id);
return parentEdge ? nodes.findLast((n) => n.id === parentEdge.source) : undefined;
}
Expand Down
Loading