Wizard: Refactor Description input using new component
This commit refactors the Description field by replacing HookValidatedInput with the new ValidatedInputAndTextArea component. It fixes a bug where the validation icon remained visible after the user cleared the Description field.
This commit is contained in:
parent
29c290abf8
commit
6afaf49452
4 changed files with 14 additions and 12 deletions
|
|
@ -417,7 +417,6 @@ export function useDetailsValidation(): StepValidation {
|
|||
const blueprintId = useAppSelector(selectBlueprintId);
|
||||
|
||||
const nameValid = isBlueprintNameValid(name);
|
||||
const descriptionValid = isBlueprintDescriptionValid(description);
|
||||
const [uniqueName, setUniqueName] = useState<boolean | null>(null);
|
||||
|
||||
const [trigger] = useLazyGetBlueprintsQuery();
|
||||
|
|
@ -467,12 +466,16 @@ export function useDetailsValidation(): StepValidation {
|
|||
return { errors: { name: '' }, disabledNext: false };
|
||||
}
|
||||
|
||||
const descriptionError = !isBlueprintDescriptionValid(description)
|
||||
? 'Invalid description'
|
||||
: '';
|
||||
|
||||
return {
|
||||
errors: {
|
||||
name: nameError,
|
||||
description: descriptionValid ? '' : 'Invalid description',
|
||||
description: descriptionError,
|
||||
},
|
||||
// if uniqueName is null, we are still waiting for the API response
|
||||
disabledNext: !!nameError || !descriptionValid || uniqueName !== true,
|
||||
disabledNext: !!nameError || !!descriptionError || uniqueName !== true,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue