From 7db4f4769f722ff6189b394ef22f1ea03b9ed726 Mon Sep 17 00:00:00 2001 From: Mert Sincan Date: Thu, 9 Jan 2025 12:02:51 +0000 Subject: [PATCH] fix: Form: errorMessage could not reactive display correctly. Fixes #6905 --- packages/forms/src/useform/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/forms/src/useform/index.js b/packages/forms/src/useform/index.js index 481f3a989..72c9ccf85 100644 --- a/packages/forms/src/useform/index.js +++ b/packages/forms/src/useform/index.js @@ -1,4 +1,4 @@ -import { isArray, isNotEmpty, mergeKeys, resolve } from '@primeuix/utils'; +import { isArray, isEmpty, isNotEmpty, mergeKeys, resolve } from '@primeuix/utils'; import { computed, getCurrentInstance, mergeProps, nextTick, onMounted, reactive, toValue, watch } from 'vue'; function tryOnMounted(fn, sync = true) { @@ -71,7 +71,7 @@ export const useForm = (options = {}) => { const defineField = (field, fieldOptions) => { if (!field) { - console.warn('The `name` attribute is required for the field definition.'); + //console.warn('The `name` attribute is required for the field definition.'); return []; // prevent errors } @@ -161,7 +161,7 @@ export const useForm = (options = {}) => { const flattenFields = [field].flat(); for (const [fieldName, fieldInst] of Object.entries(fields)) { - if (flattenFields.includes(fieldName) || !field) { + if (flattenFields.includes(fieldName) || !field || isEmpty(result.errors)) { const fieldResolver = fieldInst.options?.resolver; if (fieldResolver) {