Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Use onChange() instead of setValue() #1319

Merged
merged 2 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const SetMode: React.FC<ISetMode> = ({ isSingleApp, isModeValid }) => {
label={t("wizard.label.analysisSource")}
fieldId="analysis-mode"
isRequired
renderInput={({ field: { value, name } }) => (
renderInput={({ field: { value, name, onChange } }) => (
<SimpleSelect
id="analysis-mode"
toggleId="analysis-mode-toggle"
Expand All @@ -68,8 +68,8 @@ export const SetMode: React.FC<ISetMode> = ({ isSingleApp, isModeValid }) => {
variant="single"
value={toOptionLike(value, options)}
onChange={(selection) => {
const option = selection as OptionWithValue<AnalysisMode>;
setValue(name, option.value);
const selectionValue = selection as OptionWithValue<AnalysisMode>;
onChange(selectionValue.value);
}}
options={options}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ export const IdentityForm: React.FC<IdentityFormProps> = ({
label="Type"
fieldId="type-select"
isRequired
renderInput={({ field: { value, name } }) => (
renderInput={({ field: { value, name, onChange } }) => (
<SimpleSelect
id="type-select"
toggleId="type-select-toggle"
Expand All @@ -475,7 +475,7 @@ export const IdentityForm: React.FC<IdentityFormProps> = ({
options={kindOptions}
onChange={(selection) => {
const selectionValue = selection as OptionWithValue<IdentityKind>;
setValue(name, selectionValue.value);
onChange(selectionValue.value);
// So we don't retain the values from the wrong type of credential
resetField("user");
resetField("password");
Expand All @@ -492,7 +492,7 @@ export const IdentityForm: React.FC<IdentityFormProps> = ({
label="User credentials"
isRequired
fieldId="user-credentials-select"
renderInput={({ field: { value, name } }) => (
renderInput={({ field: { value, name, onChange } }) => (
<SimpleSelect
id="user-credentials-select"
toggleId="user-credentials-select-toggle"
Expand All @@ -507,7 +507,7 @@ export const IdentityForm: React.FC<IdentityFormProps> = ({
onChange={(selection) => {
const selectionValue =
selection as OptionWithValue<UserCredentials>;
setValue(name, selectionValue.value);
onChange(selectionValue.value);
// So we don't retain the values from the wrong type of credential
resetField("user");
resetField("password");
Expand Down
Loading