diff --git a/plugins/scaffolder-react/src/next/components/Stepper/Stepper.tsx b/plugins/scaffolder-react/src/next/components/Stepper/Stepper.tsx index bd298fcbae..e6e3295aaf 100644 --- a/plugins/scaffolder-react/src/next/components/Stepper/Stepper.tsx +++ b/plugins/scaffolder-react/src/next/components/Stepper/Stepper.tsx @@ -35,7 +35,7 @@ import { useFormDataFromQuery } from '../../hooks'; import { FormProps } from '../../types'; import { LayoutOptions } from '../../../layouts'; import { useTransformSchemaToProps } from '../../hooks/useTransformSchemaToProps'; -import { isInvalid } from './guards'; +import { hasErrors } from './guards'; const useStyles = makeStyles(theme => ({ backButton: { @@ -137,7 +137,7 @@ export const Stepper = (stepperProps: StepperProps) => { const returnedValidation = await validation(formData); - if (isInvalid(returnedValidation)) { + if (hasErrors(returnedValidation)) { setErrors(returnedValidation); } else { setErrors(undefined); diff --git a/plugins/scaffolder-react/src/next/components/Stepper/guards.ts b/plugins/scaffolder-react/src/next/components/Stepper/guards.ts index 8dfedabd77..c7afeb5664 100644 --- a/plugins/scaffolder-react/src/next/components/Stepper/guards.ts +++ b/plugins/scaffolder-react/src/next/components/Stepper/guards.ts @@ -19,7 +19,7 @@ function isFieldValidation(error: any): error is FieldValidation { return !!error && '__errors' in error; } -export function isInvalid(errors?: Record): boolean { +export function hasErrors(errors?: Record): boolean { if (!errors) { return false; } @@ -29,7 +29,7 @@ export function isInvalid(errors?: Record): boolean { return (error.__errors ?? []).length > 0; } - return isInvalid(error); + return hasErrors(error); } return false;