Skip to content

Commit

Permalink
fix: use multiple batch queues for both validation modes closes #3783
Browse files Browse the repository at this point in the history
  • Loading branch information
logaretm committed May 27, 2022
1 parent 9385457 commit 6156603
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/vee-validate/src/useForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -617,11 +617,13 @@ export function useForm<TValues extends Record<string, any> = Record<string, any

/**
* Batches validation runs in 5ms batches
* Must have two distinct batch queues to make sure they don't override each other settings #3783
*/
const debouncedSchemaValidation = debounceAsync(_validateSchema, 5);
const debouncedSilentValidation = debounceAsync(_validateSchema, 5);
const debouncedValidation = debounceAsync(_validateSchema, 5);

async function validateSchema(mode: SchemaValidationMode): Promise<FormValidationResult<TValues>> {
const formResult = await debouncedSchemaValidation();
const formResult = await (mode === 'silent' ? debouncedSilentValidation() : debouncedValidation());

// fields by id lookup
const fieldsById = formCtx.fieldsByPath.value || {};
Expand Down

0 comments on commit 6156603

Please sign in to comment.