You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Field submit error is removed on field blur without a change #1242
area: runtimeThis issue affects the runtime of the library.questionscope: coreThis issue affects the core package, meaning any adapter is also affected by it.v1This issue has been created during v1 development.v2This issue affects v2 as well.
From what I find, the onChange validator will rightly handle the blurring by maintaining errors in the state.meta.errors. onSubmit however, is causing the blur event to clear the errors.
I might be wrong but I think this is where the problem is inFieldApi.ts:
/** * when we have an error for onSubmit in the state, we want * to clear the error as soon as the user enters a valid value in the field */constsubmitErrKey=getErrorMapKey('submit')if(this.state.meta.errorMap[submitErrKey]&&cause!=='submit'&&!hasErrored){this.setMeta((prev)=>({
...prev,errorMap: {
...prev.errorMap,[submitErrKey]: undefined,},}))}
Since blur's cause is not submit, but rather "change" in the case where we blur out of a field after submitting, it won't remap the hasErrored or the errorMap. I don't know if this is by design so I will let a maintainer comment on this.
I believe this is intended design for v1, though we're open for discussion on how v2 should tackle stale errors. What events should clear them, which error sources should be considered etc. etc.
As for v2 alpha 0,
Both change and blur clear stale error sources
Stale error sources include mount, submit and server (from server-side rendering).
area: runtimeThis issue affects the runtime of the library.questionscope: coreThis issue affects the core package, meaning any adapter is also affected by it.v1This issue has been created during v1 development.v2This issue affects v2 as well.
Activity
theVedanta commentedon Mar 8, 2025
From what I find, the onChange validator will rightly handle the blurring by maintaining errors in the state.meta.errors. onSubmit however, is causing the blur event to clear the errors.
I might be wrong but I think this is where the problem is in
FieldApi.ts:Since blur's cause is not submit, but rather "change" in the case where we blur out of a field after submitting, it won't remap the hasErrored or the errorMap. I don't know if this is by design so I will let a maintainer comment on this.
LeCarbonator commentedon Aug 11, 2026
I believe this is intended design for v1, though we're open for discussion on how v2 should tackle stale errors. What events should clear them, which error sources should be considered etc. etc.
As for
v2 alpha 0,changeandblurclear stale error sourcesmount,submitandserver(from server-side rendering).