Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove defineField event args for component compat closes #4637 #4647

Merged
merged 1 commit into from
Jan 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/two-falcons-pull.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"vee-validate": patch
---

"fix: remove event arg from define field handlers for component compat closes #4637"
6 changes: 3 additions & 3 deletions packages/vee-validate/src/types/forms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ export type PublicPathState<TValue = unknown> = Omit<
>;

export interface BaseFieldProps {
onBlur: (e: Event) => void;
onChange: (e: Event) => void;
onInput: (e: Event) => void;
onBlur: () => void;
onChange: () => void;
onInput: () => void;
}

export interface InputBindsConfig<TValue = unknown, TExtraProps extends GenericObject = GenericObject> {
Expand Down
8 changes: 4 additions & 4 deletions packages/vee-validate/src/useForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1095,20 +1095,20 @@
) {
const [model, props] = defineField(path, config);

function onBlur(e: Event) {
props.value.onBlur(e);
function onBlur() {
props.value.onBlur();

Check warning on line 1099 in packages/vee-validate/src/useForm.ts

View check run for this annotation

Codecov / codecov/patch

packages/vee-validate/src/useForm.ts#L1098-L1099

Added lines #L1098 - L1099 were not covered by tests
}

function onInput(e: Event) {
const value = normalizeEventValue(e) as PathValue<TValues, TPath>;
setFieldValue(toValue(path), value, false);
props.value.onInput(e);
props.value.onInput();

Check warning on line 1105 in packages/vee-validate/src/useForm.ts

View check run for this annotation

Codecov / codecov/patch

packages/vee-validate/src/useForm.ts#L1105

Added line #L1105 was not covered by tests
}

function onChange(e: Event) {
const value = normalizeEventValue(e) as PathValue<TValues, TPath>;
setFieldValue(toValue(path), value, false);
props.value.onChange(e);
props.value.onChange();

Check warning on line 1111 in packages/vee-validate/src/useForm.ts

View check run for this annotation

Codecov / codecov/patch

packages/vee-validate/src/useForm.ts#L1111

Added line #L1111 was not covered by tests
}

return computed(() => {
Expand Down