Skip to content

Commit

Permalink
fix: only show value proxy warning if the value is an object
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed May 7, 2023
1 parent ab9610f commit 18f3c1c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/vee-validate/src/useField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import {
lazyToRef,
unravel,
} from './utils';
import { isCallable } from '../../shared';
import { isCallable, isObject } from '../../shared';
import { FieldContextKey, FormContextKey, IS_ABSENT } from './symbols';
import { useFieldState } from './useFieldState';
import { refreshInspector, registerSingleFieldWithDevtools } from './devtools';
Expand Down Expand Up @@ -284,6 +284,10 @@ function _useField<TValue = unknown>(
watch(
valueProxy,
(value, oldValue) => {
if (!isObject(value)) {
return;
}

if (value === oldValue && isEqual(value, oldValue)) {
warn(
'Detected a possible deep change on field `value` ref, for nested changes please either set the entire ref value or use `setValue` or `handleChange`.'
Expand Down

0 comments on commit 18f3c1c

Please sign in to comment.