Skip to content

Commit 1abfc42

Browse files
committed
2783 - SF
1 parent f65c6e4 commit 1abfc42

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

client/src/pages/platform/workflow-editor/utils/saveRootTaskDispatcher.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,19 @@ import {Node} from '@xyflow/react';
1212
import saveWorkflowDefinition from './saveWorkflowDefinition';
1313
import {TASK_DISPATCHER_CONFIG} from './taskDispatcherConfig';
1414

15+
/**
16+
* Maps task dispatcher names to their corresponding property names
17+
* Handles special cases like 'fork-join' -> 'forkJoin'
18+
*/
19+
function getTaskDispatcherPropertyName(taskDispatcherName: string): string {
20+
switch (taskDispatcherName) {
21+
case 'fork-join':
22+
return 'forkJoin';
23+
default:
24+
return taskDispatcherName;
25+
}
26+
}
27+
1528
interface SaveRootTaskDispatcherProps {
1629
invalidateWorkflowQueries: () => void;
1730
nodes: Node[];
@@ -107,17 +120,17 @@ function getRecursivelyUpdatedRootTaskDispatcherNodeData(
107120

108121
// Look for parent dispatchers of all types
109122
for (const taskDispatcherName of TASK_DISPATCHER_NAMES) {
123+
const propertyName = getTaskDispatcherPropertyName(taskDispatcherName);
124+
110125
const taskDispatcherData = nodeData[
111-
`${taskDispatcherName as keyof typeof TASK_DISPATCHER_CONFIG}Data`
126+
`${propertyName}Data` as keyof typeof nodeData
112127
] as TaskDispatcherContextType;
113128

114129
if (!taskDispatcherData) {
115130
continue;
116131
}
117132

118-
const taskDispatcherId: string = (taskDispatcherData as TaskDispatcherDataType)[
119-
`${taskDispatcherName as keyof typeof TASK_DISPATCHER_CONFIG}Id`
120-
];
133+
const taskDispatcherId: string = (taskDispatcherData as unknown as Record<string, string>)[`${propertyName}Id`];
121134

122135
const taskDispatcherConfig = TASK_DISPATCHER_CONFIG[taskDispatcherName as keyof typeof TASK_DISPATCHER_CONFIG];
123136

0 commit comments

Comments
 (0)