fix: form field validate not check mount status #2206
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
中文模板 / Chinese Template
What kind of change does this PR introduce? (check at least one)
PR description
Field 校验完成后,没有验证 Field 是不是已经处于被卸载的状态;
因此在校验开始 -> 卸载Field -> 校验结束这个过程中,校验结果(假设为失败)仍然会写入到 FormState;
Field 重新挂载后,再触发(不管是通过API调用还是事件触发)Field 的校验,因为该 Field 自身的 state 中是校验成功状态,因此不会将新的校验结果写入到 FormState,导致 FormState 中仍然保留失败的状态。
After the Field verification is completed, it is not verified whether the Field has been unmounted;
Therefore, during the process of verification starting -> unmount Field -> verification ending, the verification result (assumed to be a failure) will still be written to FormState;
After the Field is remounted, trigger verification again (whether triggered by an API call or an event). Because the Field's own state is a verification success state, the new verification results will not be written to the FormState. Causes the failed state to remain in FormState.
Changelog
🇨🇳 Chinese
🇺🇸 English
Checklist
Other
Additional information