@tanstack/form-core
Advanced tools
Comparing version 0.36.1 to 0.36.2
@@ -285,17 +285,7 @@ import { Store } from "@tanstack/store"; | ||
if (!this.state.meta.isTouched) return []; | ||
let validationErrorFromForm = {}; | ||
let formValidationResultPromise = Promise.resolve({}); | ||
try { | ||
const formValidationResult = this.form.validate(cause); | ||
if (formValidationResult instanceof Promise) { | ||
formValidationResultPromise = formValidationResult; | ||
} else { | ||
const fieldErrorFromForm = formValidationResult[this.name]; | ||
if (fieldErrorFromForm) { | ||
validationErrorFromForm = fieldErrorFromForm; | ||
} | ||
} | ||
} catch (_) { | ||
} | ||
const { hasErrored } = this.validateSync(cause, validationErrorFromForm); | ||
const { fieldsErrorMap } = this.form.validateSync(cause); | ||
const { hasErrored } = this.validateSync( | ||
cause, | ||
fieldsErrorMap[this.name] ?? {} | ||
); | ||
if (hasErrored && !this.options.asyncAlways) { | ||
@@ -305,2 +295,3 @@ (_a = this.getInfo().validationMetaMap[getErrorMapKey(cause)]) == null ? void 0 : _a.lastAbortController.abort(); | ||
} | ||
const formValidationResultPromise = this.form.validateAsync(cause); | ||
return this.validateAsync(cause, formValidationResultPromise); | ||
@@ -307,0 +298,0 @@ }; |
{ | ||
"name": "@tanstack/form-core", | ||
"version": "0.36.1", | ||
"version": "0.36.2", | ||
"description": "Powerful, type-safe, framework agnostic forms.", | ||
@@ -5,0 +5,0 @@ "author": "tannerlinsley", |
@@ -981,21 +981,8 @@ import { Store } from '@tanstack/store' | ||
let validationErrorFromForm: ValidationErrorMap = {} | ||
let formValidationResultPromise: Promise< | ||
FieldsErrorMapFromValidator<TParentData> | ||
> = Promise.resolve({}) | ||
try { | ||
const formValidationResult = this.form.validate(cause) | ||
if (formValidationResult instanceof Promise) { | ||
formValidationResultPromise = formValidationResult | ||
} else { | ||
const fieldErrorFromForm = formValidationResult[this.name] | ||
if (fieldErrorFromForm) { | ||
validationErrorFromForm = fieldErrorFromForm | ||
} | ||
} | ||
} catch (_) {} | ||
// Attempt to sync validate first | ||
const { hasErrored } = this.validateSync(cause, validationErrorFromForm) | ||
const { fieldsErrorMap } = this.form.validateSync(cause) | ||
const { hasErrored } = this.validateSync( | ||
cause, | ||
fieldsErrorMap[this.name] ?? {}, | ||
) | ||
@@ -1008,3 +995,5 @@ if (hasErrored && !this.options.asyncAlways) { | ||
} | ||
// No error? Attempt async validation | ||
const formValidationResultPromise = this.form.validateAsync(cause) | ||
return this.validateAsync(cause, formValidationResultPromise) | ||
@@ -1011,0 +1000,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
473035
6242