Skip to content

Commit

Permalink
fix: define binds not respecting config events
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed Jun 25, 2023
1 parent 52bd89f commit 1660048
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/old-donuts-argue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'vee-validate': patch
---

fix: define binds not respecting config events
10 changes: 2 additions & 8 deletions packages/vee-validate/src/useForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -933,20 +933,14 @@ export function useForm<

function onInput(e: Event) {
const value = normalizeEventValue(e) as PathValue<TValues, TPath>;
setFieldValue(pathState.path as Path<TValues>, value);
const validateOnInput = evalConfig().validateOnInput ?? getConfig().validateOnInput;
if (validateOnInput) {
validateField(pathState.path as Path<TValues>);
}
setFieldValue(pathState.path as Path<TValues>, value, validateOnInput);
}

function onChange(e: Event) {
const value = normalizeEventValue(e) as PathValue<TValues, TPath>;
setFieldValue(pathState.path as Path<TValues>, value);
const validateOnChange = evalConfig().validateOnChange ?? getConfig().validateOnChange;
if (validateOnChange) {
validateField(pathState.path as Path<TValues>);
}
setFieldValue(pathState.path as Path<TValues>, value, validateOnChange);
}

const props = computed(() => {
Expand Down

0 comments on commit 1660048

Please sign in to comment.