Skip to content

Commit 88206c9

Browse files
Merge pull request opendatahub-io#1621 from pnaik1/issue-1516
Parameters from triggered runs not copied when run is duplicated
2 parents 8a468d0 + 3acf411 commit 88206c9

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

frontend/src/concepts/pipelines/content/createRun/contentSections/PipelineSection.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ const PipelineSection: React.FC<PipelineSectionProps> = ({ onLoaded, value, onCh
2020
const [pipelines, loaded] = usePipelines();
2121
React.useEffect(() => {
2222
onLoaded(loaded);
23-
}, [onLoaded, loaded]);
23+
// only run when `loaded` changes
24+
// eslint-disable-next-line react-hooks/exhaustive-deps
25+
}, [loaded]);
2426
if (!loaded) {
2527
return <Skeleton />;
2628
}

frontend/src/concepts/pipelines/content/createRun/useRunFormData.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,23 +57,21 @@ const useUpdateData = <T extends PipelineCoreResourceKF>(
5757

5858
const useUpdatePipeline = (
5959
setFunction: UpdateObjectAtPropAndValue<RunFormData>,
60-
initialData?: PipelineCoreResourceKF,
60+
initialData?: PipelineRunKF | PipelineRunJobKF,
6161
) => {
62-
const updatedSetFunction = React.useCallback(
62+
const updatedSetFunction = React.useCallback<UpdateObjectAtPropAndValue<RunFormData>>(
6363
(key, resource) => {
6464
setFunction(key, resource);
65-
if (resource && 'parameters' in resource) {
66-
setFunction(
67-
'params',
68-
(resource.parameters || []).map((p) => ({ label: p.name, value: p.value ?? '' })),
69-
);
70-
} else {
71-
setFunction('params', []);
72-
}
65+
setFunction(
66+
'params',
67+
initialData?.pipeline_spec.parameters?.map((p) => ({
68+
label: p.name,
69+
value: p.value ?? '',
70+
})) ?? [],
71+
);
7372
},
74-
[setFunction],
73+
[setFunction, initialData?.pipeline_spec.parameters],
7574
);
76-
7775
return useUpdateData(
7876
updatedSetFunction,
7977
initialData,

frontend/src/concepts/pipelines/kfTypes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export type PipelineSpecKF = {
108108
pipeline_name?: string;
109109
workflow_manifest?: string;
110110
pipeline_manifests?: string;
111-
parameters: ParameterKF[];
111+
parameters?: ParameterKF[];
112112
runtime_config: PipelineSpecRuntimeConfig;
113113
};
114114

0 commit comments

Comments
 (0)