Skip to content

Commit

Permalink
feat(breaking): disable v-model support by default closes #4283
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed May 31, 2023
1 parent 75216dd commit 7ce9d67
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/fifty-weeks-eat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'vee-validate': minor
---

feat(breaking): disable v-model support by default closes #4283
1 change: 1 addition & 0 deletions packages/vee-validate/src/Field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ const FieldImpl = /** #__PURE__ */ defineComponent({
label,
validateOnValueUpdate: false,
keepValueOnUnmount: keepValue,
syncVModel: true,
});

// If there is a v-model applied on the component we need to emit the `update:modelValue` whenever the value binding changes
Expand Down
2 changes: 1 addition & 1 deletion packages/vee-validate/src/useField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ function normalizeOptions<TValue>(opts: Partial<FieldOptions<TValue>> | undefine
validateOnValueUpdate: true,
keepValueOnUnmount: undefined,
modelPropName: 'modelValue',
syncVModel: true,
syncVModel: false,
controlled: true,
});

Expand Down
1 change: 1 addition & 0 deletions packages/vee-validate/tests/Form.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2814,6 +2814,7 @@ describe('<Form />', () => {
type: 'checkbox',
uncheckedValue: false,
checkedValue: true,
syncVModel: true,
});

return {
Expand Down
3 changes: 2 additions & 1 deletion packages/vee-validate/tests/useField.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ describe('useField()', () => {
modelValue: String,
},
setup() {
const { value, errorMessage } = useField('field');
const { value, errorMessage } = useField('field', undefined, { syncVModel: true });

return {
value,
Expand Down Expand Up @@ -691,6 +691,7 @@ describe('useField()', () => {
setup() {
const { value, errorMessage } = useField('field', undefined, {
modelPropName: 'textVal',
syncVModel: true,
});

return {
Expand Down

0 comments on commit 7ce9d67

Please sign in to comment.