Skip to content

Commit

Permalink
fix: add missing field onSubmitAsyncDebounceMs value
Browse files Browse the repository at this point in the history
  • Loading branch information
crutchcorn committed Dec 3, 2023
1 parent f70735c commit 94df01d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/form-core/src/FieldApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export interface FieldValidators<
FormValidator,
TData
>
onSubmitAsyncDebounceMs?: number
}

export interface FieldOptions<
Expand Down Expand Up @@ -478,6 +479,7 @@ export class FieldApi<
onSubmitAsync,
onBlurAsyncDebounceMs,
onChangeAsyncDebounceMs,
onSubmitAsyncDebounceMs,
} = this.options.validators || {}

const validate =
Expand All @@ -487,14 +489,12 @@ export class FieldApi<
? onSubmitAsync
: onBlurAsync
if (!validate) return []
const debounceMs =
cause === 'submit'
? 0
: (cause === 'change'
? onChangeAsyncDebounceMs
: onBlurAsyncDebounceMs) ??
asyncDebounceMs ??
0

let debounceMs = asyncDebounceMs ?? 0

if (cause === 'submit') debounceMs = onSubmitAsyncDebounceMs ?? debounceMs
if (cause === 'change') debounceMs = onChangeAsyncDebounceMs ?? debounceMs
if (cause === 'blur') debounceMs = onBlurAsyncDebounceMs ?? debounceMs

if (this.state.meta.isValidating !== true) {
this.setMeta((prev) => ({ ...prev, isValidating: true }))
Expand Down

0 comments on commit 94df01d

Please sign in to comment.