Skip to content

Commit 4914cf9

Browse files
petrapazkresimir-coko
authored andcommitted
4822 - avoid redundant workflowNodeLabelMap computation when connections are grouped
1 parent aed85d5 commit 4914cf9

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

client/src/pages/platform/workflow-editor/components/WorkflowTestConfigurationDialog.tsx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -249,19 +249,20 @@ const WorkflowTestConfigurationDialog = ({
249249
},
250250
});
251251

252-
const workflowNodeLabelMap = new Map<string, string>();
252+
const workflowNodeLabelMap = useMemo(() => {
253+
if (connectionsGrouped) return new Map<string, string>();
253254

254-
for (const task of workflow?.tasks ?? []) {
255-
if (task.label) {
256-
workflowNodeLabelMap.set(task.name, task.label);
257-
}
258-
}
255+
const map = new Map<string, string>();
259256

260-
for (const trigger of workflow?.triggers ?? []) {
261-
if (trigger.label) {
262-
workflowNodeLabelMap.set(trigger.name, trigger.label);
257+
for (const task of workflow?.tasks ?? []) {
258+
if (task.label) map.set(task.name, task.label);
263259
}
264-
}
260+
for (const trigger of workflow?.triggers ?? []) {
261+
if (trigger.label) map.set(trigger.name, trigger.label);
262+
}
263+
264+
return map;
265+
}, [connectionsGrouped, workflow?.tasks, workflow?.triggers]);
265266

266267
function saveWorkflowTestConfiguration(workflowTestConfiguration: WorkflowTestConfiguration) {
267268
workflowTestConfiguration = {

0 commit comments

Comments
 (0)