Skip to content
This repository was archived by the owner on Jan 27, 2026. It is now read-only.

Commit 0f745c2

Browse files
authored
fix(orchestrator): pass also initial form data to custom decorator (#2561)
1 parent 9f20ced commit 0f745c2

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

.changeset/cyan-tigers-jam.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@janus-idp/backstage-plugin-orchestrator-form-react": patch
3+
"@janus-idp/backstage-plugin-orchestrator-form-api": patch
4+
"@janus-idp/backstage-plugin-orchestrator": patch
5+
---
6+
7+
pass also initial form data to custom decorator

plugins/orchestrator-form-api/src/api.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export interface OrchestratorFormApi {
4141
getFormDecorator(
4242
schema: JSONSchema7,
4343
uiSchema: UiSchema<JsonObject, JSONSchema7>,
44+
initialFormData?: JsonObject
4445
): OrchestratorFormDecorator;
4546
}
4647

plugins/orchestrator-form-react/src/components/OrchestratorFormWrapper.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,17 @@ const FormComponent = (decoratorProps: FormDecoratorProps) => {
135135
const OrchestratorFormWrapper = ({
136136
schema,
137137
uiSchema,
138+
formData,
138139
...props
139140
}: OrchestratorFormWrapperProps) => {
140141
const formApi =
141142
useApiHolder().get(orchestratorFormApiRef) || defaultFormExtensionsApi;
142143
const NewComponent = React.useMemo(() => {
143-
const formDecorator = formApi.getFormDecorator(schema, uiSchema);
144+
const formDecorator = formApi.getFormDecorator(schema, uiSchema, formData);
144145
return formDecorator(FormComponent);
145-
}, [schema, formApi, uiSchema]);
146+
}, [schema, formApi, uiSchema, formData]);
146147
return (
147-
<WrapperFormPropsContext.Provider value={{ schema, uiSchema, ...props }}>
148+
<WrapperFormPropsContext.Provider value={{ schema, uiSchema, formData, ...props }}>
148149
<NewComponent />
149150
</WrapperFormPropsContext.Provider>
150151
);

0 commit comments

Comments
 (0)