Merge pull request #9391 from snehaljos/issue9157

Fixed bug in UI | Fix for issue #9157
This commit is contained in:
Ben Lambert
2022-02-08 15:01:28 +01:00
committed by GitHub
3 changed files with 13 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder': patch
---
Encode the `formData` in the `queryString` using `JSON.stringify` to keep the types in the decoded value
@@ -302,7 +302,9 @@ export const TaskPage = ({ loadingText }: TaskPageProps) => {
navigate(
generatePath(
`${rootLink()}/templates/:templateName?${qs.stringify({ formData })}`,
`${rootLink()}/templates/:templateName?${qs.stringify({
formData: JSON.stringify(formData),
})}`,
{
templateName: taskStream.task!.spec.metadata!.name,
},
@@ -128,7 +128,11 @@ export const TemplatePage = ({
ignoreQueryPrefix: true,
});
return query.formData ?? {};
try {
return JSON.parse(query.formData as string);
} catch (e) {
return query.formData ?? {};
}
});
const handleFormReset = () => setFormState({});
const handleChange = useCallback(