Skip to content

Commit

Permalink
feat: reduce initial schema validation calls
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed Aug 12, 2024
1 parent a7742a5 commit c83bb98
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/form/useForm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ describe('form validation', () => {
});
});

await nextTick();
await flush();
expect(getError('test')).toBe('error');
await reset();
expect(getError('test')).toBeUndefined();
Expand All @@ -672,7 +672,7 @@ describe('form validation', () => {
});
});

await nextTick();
await flush();
expect(getError('test')).toBe('error');
wasReset = true;
await reset({ revalidate: true });
Expand Down
4 changes: 1 addition & 3 deletions packages/core/src/form/useForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ export function useForm<TForm extends FormObject = FormObject, TOutput extends F
} as FormContext<TForm, TOutput>);

if (ctx.getValidationMode() === 'schema') {
onMounted(() => {
actions.validate();
});
onMounted(privateActions.requestValidation);
}

return {
Expand Down

0 comments on commit c83bb98

Please sign in to comment.