diff --git a/packages/forms/src/useform/index.js b/packages/forms/src/useform/index.js index b4527b8db..481f3a989 100644 --- a/packages/forms/src/useform/index.js +++ b/packages/forms/src/useform/index.js @@ -70,6 +70,12 @@ export const useForm = (options = {}) => { }; const defineField = (field, fieldOptions) => { + if (!field) { + console.warn('The `name` attribute is required for the field definition.'); + + return []; // prevent errors + } + fields[field]?._watcher.stop(); states[field] ||= getInitialState(field, fieldOptions?.initialValue);