Skip to content

Commit

Permalink
fix(validation): null check errorMessages
Browse files Browse the repository at this point in the history
  • Loading branch information
KaelWD committed Sep 27, 2023
1 parent 56b8137 commit 6c7a4b9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/vuetify/src/composables/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type ValidateOnValue = 'blur' | 'input' | 'submit'
export interface ValidationProps {
disabled: boolean | null
error: boolean
errorMessages: string | readonly string[]
errorMessages: string | readonly string[] | null
focused: boolean
maxErrors: string | number
name: string | undefined
Expand Down Expand Up @@ -85,7 +85,7 @@ export function useValidation (
const isDisabled = computed(() => !!(props.disabled ?? form?.isDisabled.value))
const isReadonly = computed(() => !!(props.readonly ?? form?.isReadonly.value))
const errorMessages = computed(() => {
return props.errorMessages.length
return props.errorMessages?.length
? wrapInArray(props.errorMessages).slice(0, Math.max(0, +props.maxErrors))
: internalErrorMessages.value
})
Expand All @@ -102,7 +102,7 @@ export function useValidation (
}
})
const isValid = computed(() => {
if (props.error || props.errorMessages.length) return false
if (props.error || props.errorMessages?.length) return false
if (!props.rules.length) return true
if (isPristine.value) {
return internalErrorMessages.value.length || validateOn.value.lazy ? null : true
Expand Down

0 comments on commit 6c7a4b9

Please sign in to comment.