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:
Michal Gold 2025-03-16 13:45:26 +02:00 committed by Klara Simickova
parent 29c290abf8
commit 6afaf49452
4 changed files with 14 additions and 12 deletions

View file

@ -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,
};
}