From ccbf1c8ed2aa439b5ba8313ebfec51c2d43b36e6 Mon Sep 17 00:00:00 2001 From: Gilles Dubreuil Date: Tue, 29 Aug 2023 16:55:19 +0200 Subject: [PATCH 1/2] Use onChange() instead of setValue() Signed-off-by: Gilles Dubreuil --- .../pages/applications/analysis-wizard/set-mode.tsx | 6 +++--- .../components/identity-form/identity-form.tsx | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/client/src/app/pages/applications/analysis-wizard/set-mode.tsx b/client/src/app/pages/applications/analysis-wizard/set-mode.tsx index 6a2ce9238..ee2667486 100644 --- a/client/src/app/pages/applications/analysis-wizard/set-mode.tsx +++ b/client/src/app/pages/applications/analysis-wizard/set-mode.tsx @@ -59,7 +59,7 @@ export const SetMode: React.FC = ({ isSingleApp, isModeValid }) => { label={t("wizard.label.analysisSource")} fieldId="analysis-mode" isRequired - renderInput={({ field: { value, name } }) => ( + renderInput={({ field: { value, name, onChange } }) => ( = ({ isSingleApp, isModeValid }) => { variant="single" value={toOptionLike(value, options)} onChange={(selection) => { - const option = selection as OptionWithValue; - setValue(name, option.value); + const selectionValue = selection as OptionWithValue; + onChange(selectionValue.value); }} options={options} /> diff --git a/client/src/app/pages/identities/components/identity-form/identity-form.tsx b/client/src/app/pages/identities/components/identity-form/identity-form.tsx index d99e16785..2af7882eb 100644 --- a/client/src/app/pages/identities/components/identity-form/identity-form.tsx +++ b/client/src/app/pages/identities/components/identity-form/identity-form.tsx @@ -465,7 +465,7 @@ export const IdentityForm: React.FC = ({ label="Type" fieldId="type-select" isRequired - renderInput={({ field: { value, name } }) => ( + renderInput={({ field: { value, name, onChange } }) => ( = ({ options={kindOptions} onChange={(selection) => { const selectionValue = selection as OptionWithValue; - setValue(name, selectionValue.value); + onChange(selectionValue.value); // So we don't retain the values from the wrong type of credential resetField("user"); resetField("password"); @@ -485,14 +485,14 @@ export const IdentityForm: React.FC = ({ /> {values?.kind === "source" && ( - <> +
( + renderInput={({ field: { value, name, onChange } }) => ( = ({ onChange={(selection) => { const selectionValue = selection as OptionWithValue; - setValue(name, selectionValue.value); + onChange(selectionValue.value); // So we don't retain the values from the wrong type of credential resetField("user"); resetField("password"); @@ -612,7 +612,7 @@ export const IdentityForm: React.FC = ({ /> )} - +
)} {values?.kind === "maven" && ( From b206bc596a8596126d2f8a6de038c489f263797e Mon Sep 17 00:00:00 2001 From: Gilles Dubreuil Date: Tue, 29 Aug 2023 17:06:43 +0200 Subject: [PATCH 2/2] cleanup Signed-off-by: Gilles Dubreuil --- .../identities/components/identity-form/identity-form.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/app/pages/identities/components/identity-form/identity-form.tsx b/client/src/app/pages/identities/components/identity-form/identity-form.tsx index 2af7882eb..67b051b04 100644 --- a/client/src/app/pages/identities/components/identity-form/identity-form.tsx +++ b/client/src/app/pages/identities/components/identity-form/identity-form.tsx @@ -485,7 +485,7 @@ export const IdentityForm: React.FC = ({ /> {values?.kind === "source" && ( -
+ <> = ({ /> )} -
+ )} {values?.kind === "maven" && (