Skip to content

Commit

Permalink
fix: remove deep data mutation warning closes #4597
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed Dec 16, 2023
1 parent e2171f8 commit 72e4379
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
5 changes: 5 additions & 0 deletions .changeset/few-rice-travel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"vee-validate": patch
---

fix: remove deep data mutation warning closes #4597
21 changes: 1 addition & 20 deletions packages/vee-validate/src/useField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
Ref,
ComponentInternalInstance,
onBeforeUnmount,
warn,
toValue,
MaybeRef,
MaybeRefOrGetter,
Expand Down Expand Up @@ -43,7 +42,7 @@ import {
isEqual,
isTypedSchema,
} from './utils';
import { isCallable, isObject, normalizeFormPath } from '../../shared';
import { isCallable, normalizeFormPath } from '../../shared';
import { FieldContextKey, FormContextKey, IS_ABSENT } from './symbols';
import { useFieldState } from './useFieldState';
import { refreshInspector, registerSingleFieldWithDevtools } from './devtools';
Expand Down Expand Up @@ -291,24 +290,6 @@ function _useField<TValue = unknown>(
},
});

if (__DEV__) {
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`.',
);
}
},
{ deep: true },
);
}

const field: PrivateFieldContext<TValue> = {
id,
name,
Expand Down

0 comments on commit 72e4379

Please sign in to comment.