diff --git a/.changeset/cyan-tigers-jam.md b/.changeset/cyan-tigers-jam.md new file mode 100644 index 0000000000..40cad27e35 --- /dev/null +++ b/.changeset/cyan-tigers-jam.md @@ -0,0 +1,7 @@ +--- +"@janus-idp/backstage-plugin-orchestrator-form-react": patch +"@janus-idp/backstage-plugin-orchestrator-form-api": patch +"@janus-idp/backstage-plugin-orchestrator": patch +--- + +pass also initial form data to custom decorator diff --git a/plugins/orchestrator-form-api/src/api.ts b/plugins/orchestrator-form-api/src/api.ts index c3ba1c2030..9e200fab8b 100644 --- a/plugins/orchestrator-form-api/src/api.ts +++ b/plugins/orchestrator-form-api/src/api.ts @@ -41,6 +41,7 @@ export interface OrchestratorFormApi { getFormDecorator( schema: JSONSchema7, uiSchema: UiSchema, + initialFormData?: JsonObject, ): OrchestratorFormDecorator; } diff --git a/plugins/orchestrator-form-react/src/components/OrchestratorFormWrapper.tsx b/plugins/orchestrator-form-react/src/components/OrchestratorFormWrapper.tsx index 1cc025ae59..db28417270 100644 --- a/plugins/orchestrator-form-react/src/components/OrchestratorFormWrapper.tsx +++ b/plugins/orchestrator-form-react/src/components/OrchestratorFormWrapper.tsx @@ -135,16 +135,19 @@ const FormComponent = (decoratorProps: FormDecoratorProps) => { const OrchestratorFormWrapper = ({ schema, uiSchema, + formData, ...props }: OrchestratorFormWrapperProps) => { const formApi = useApiHolder().get(orchestratorFormApiRef) || defaultFormExtensionsApi; const NewComponent = React.useMemo(() => { - const formDecorator = formApi.getFormDecorator(schema, uiSchema); + const formDecorator = formApi.getFormDecorator(schema, uiSchema, formData); return formDecorator(FormComponent); - }, [schema, formApi, uiSchema]); + }, [schema, formApi, uiSchema, formData]); return ( - + );