From 61b31717363a17cc7f43de91790cbeab06f966fa Mon Sep 17 00:00:00 2001 From: Lokananda Prabhu Date: Wed, 25 Mar 2026 17:02:02 +0530 Subject: [PATCH 1/2] fix(orchestrator-form-react): scope async validation to active step Limit validate:url requests to the active step during multi-step navigation. Made-with: Cursor --- .../scope-async-validation-to-step.md | 5 +++++ .../components/OrchestratorFormWrapper.tsx | 19 ++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 workspaces/orchestrator/.changeset/scope-async-validation-to-step.md diff --git a/workspaces/orchestrator/.changeset/scope-async-validation-to-step.md b/workspaces/orchestrator/.changeset/scope-async-validation-to-step.md new file mode 100644 index 0000000000..e83b4863b7 --- /dev/null +++ b/workspaces/orchestrator/.changeset/scope-async-validation-to-step.md @@ -0,0 +1,5 @@ +--- +'@red-hat-developer-hub/backstage-plugin-orchestrator-form-react': patch +--- + +Scope async validate:url calls to the active step in multi-step forms. diff --git a/workspaces/orchestrator/plugins/orchestrator-form-react/src/components/OrchestratorFormWrapper.tsx b/workspaces/orchestrator/plugins/orchestrator-form-react/src/components/OrchestratorFormWrapper.tsx index 78a170682b..dd23c10e6b 100644 --- a/workspaces/orchestrator/plugins/orchestrator-form-react/src/components/OrchestratorFormWrapper.tsx +++ b/workspaces/orchestrator/plugins/orchestrator-form-react/src/components/OrchestratorFormWrapper.tsx @@ -91,11 +91,28 @@ const FormComponent = (decoratorProps: FormDecoratorProps) => { let _extraErrors: ErrorSchema | undefined = undefined; let _validationError: Error | undefined = undefined; const activeKey = getActiveKey(); + const shouldScopeExtraErrors = + Boolean(activeKey) && Boolean(uiSchema?.[activeKey as string]); + const extraErrorsFormData = shouldScopeExtraErrors + ? ({ + [activeKey as string]: ((formData?.[ + activeKey as string + ] as JsonObject) ?? {}) as JsonObject, + } as JsonObject) + : formData; + const extraErrorsUiSchema = shouldScopeExtraErrors + ? ({ + [activeKey as string]: uiSchema?.[activeKey as string], + } as OrchestratorFormContextProps['uiSchema']) + : uiSchema; if (decoratorProps.getExtraErrors) { try { handleValidateStarted(); - _extraErrors = await decoratorProps.getExtraErrors(formData, uiSchema); + _extraErrors = await decoratorProps.getExtraErrors( + extraErrorsFormData, + extraErrorsUiSchema, + ); if (activeKey) { setExtraErrors( From 00bbf6634d310796ce539bc5cde838b08df0cab9 Mon Sep 17 00:00:00 2001 From: Lokananda Prabhu Date: Tue, 31 Mar 2026 14:49:19 +0530 Subject: [PATCH 2/2] fix(orchestrator-form-react): keep full formData for async validation Pass full formData to template evaluation while scoping uiSchema traversal. Made-with: Cursor --- .../src/components/OrchestratorFormWrapper.tsx | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/workspaces/orchestrator/plugins/orchestrator-form-react/src/components/OrchestratorFormWrapper.tsx b/workspaces/orchestrator/plugins/orchestrator-form-react/src/components/OrchestratorFormWrapper.tsx index dd23c10e6b..313d8b58ec 100644 --- a/workspaces/orchestrator/plugins/orchestrator-form-react/src/components/OrchestratorFormWrapper.tsx +++ b/workspaces/orchestrator/plugins/orchestrator-form-react/src/components/OrchestratorFormWrapper.tsx @@ -93,13 +93,7 @@ const FormComponent = (decoratorProps: FormDecoratorProps) => { const activeKey = getActiveKey(); const shouldScopeExtraErrors = Boolean(activeKey) && Boolean(uiSchema?.[activeKey as string]); - const extraErrorsFormData = shouldScopeExtraErrors - ? ({ - [activeKey as string]: ((formData?.[ - activeKey as string - ] as JsonObject) ?? {}) as JsonObject, - } as JsonObject) - : formData; + const extraErrorsFormData = (_formData ?? formData) as JsonObject; const extraErrorsUiSchema = shouldScopeExtraErrors ? ({ [activeKey as string]: uiSchema?.[activeKey as string],