@tanstack/form-core
Advanced tools
Comparing version 0.34.3 to 0.34.4
@@ -420,3 +420,8 @@ import { Store } from "@tanstack/store"; | ||
isBlurred: true, | ||
isDirty: true | ||
isDirty: true, | ||
errorMap: { | ||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition | ||
...prev == null ? void 0 : prev.errorMap, | ||
onMount: void 0 | ||
} | ||
})); | ||
@@ -533,3 +538,3 @@ } | ||
onUpdate: () => { | ||
var _a2, _b; | ||
var _a2, _b, _c, _d; | ||
let { state } = this.store; | ||
@@ -545,4 +550,15 @@ const fieldMetaValues = Object.values(state.fieldMeta); | ||
const isBlurred = fieldMetaValues.some((field) => field == null ? void 0 : field.isBlurred); | ||
if (isTouched && ((_a2 = state == null ? void 0 : state.errorMap) == null ? void 0 : _a2.onMount)) { | ||
state.errorMap.onMount = void 0; | ||
} | ||
const isDirty = fieldMetaValues.some((field) => field == null ? void 0 : field.isDirty); | ||
const isPristine = !isDirty; | ||
const hasOnMountError = Boolean( | ||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition | ||
((_b = state.errorMap) == null ? void 0 : _b.onMount) || // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition | ||
fieldMetaValues.some((f) => { | ||
var _a3; | ||
return (_a3 = f == null ? void 0 : f.errorMap) == null ? void 0 : _a3.onMount; | ||
}) | ||
); | ||
const isValidating = isFieldsValidating || state.isFormValidating; | ||
@@ -562,3 +578,3 @@ state.errors = Object.values(state.errorMap).reduce((prev, curr) => { | ||
const isValid = isFieldsValid && isFormValid; | ||
const canSubmit = state.submissionAttempts === 0 && !isTouched || !isValidating && !state.isSubmitting && isValid; | ||
const canSubmit = state.submissionAttempts === 0 && !isTouched && !hasOnMountError || !isValidating && !state.isSubmitting && isValid; | ||
state = { | ||
@@ -578,6 +594,6 @@ ...state, | ||
this.store.state = this.state; | ||
const transformArray = ((_a2 = this.options.transform) == null ? void 0 : _a2.deps) ?? []; | ||
const transformArray = ((_c = this.options.transform) == null ? void 0 : _c.deps) ?? []; | ||
const shouldTransform = transformArray.length !== this.prevTransformArray.length || transformArray.some((val, i) => val !== this.prevTransformArray[i]); | ||
if (shouldTransform) { | ||
(_b = this.options.transform) == null ? void 0 : _b.fn(this); | ||
(_d = this.options.transform) == null ? void 0 : _d.fn(this); | ||
this.store.state = this.state; | ||
@@ -584,0 +600,0 @@ this.prevTransformArray = transformArray; |
{ | ||
"name": "@tanstack/form-core", | ||
"version": "0.34.3", | ||
"version": "0.34.4", | ||
"description": "Powerful, type-safe, framework agnostic forms.", | ||
@@ -5,0 +5,0 @@ "author": "tannerlinsley", |
@@ -415,5 +415,17 @@ import { Store } from '@tanstack/store' | ||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition | ||
if (isTouched && state?.errorMap?.onMount) { | ||
state.errorMap.onMount = undefined | ||
} | ||
const isDirty = fieldMetaValues.some((field) => field?.isDirty) | ||
const isPristine = !isDirty | ||
const hasOnMountError = Boolean( | ||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition | ||
state.errorMap?.onMount || | ||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition | ||
fieldMetaValues.some((f) => f?.errorMap?.onMount), | ||
) | ||
const isValidating = isFieldsValidating || state.isFormValidating | ||
@@ -435,3 +447,5 @@ state.errors = Object.values(state.errorMap).reduce((prev, curr) => { | ||
const canSubmit = | ||
(state.submissionAttempts === 0 && !isTouched) || | ||
(state.submissionAttempts === 0 && | ||
!isTouched && | ||
!hasOnMountError) || | ||
(!isValidating && !state.isSubmitting && isValid) | ||
@@ -1073,2 +1087,7 @@ | ||
isDirty: true, | ||
errorMap: { | ||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition | ||
...prev?.errorMap, | ||
onMount: undefined, | ||
}, | ||
})) | ||
@@ -1075,0 +1094,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
474089
6267