Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

异步校验事件比较长的时候,错误信息无法展示 #51

Closed
bindoon opened this issue Jul 12, 2021 · 0 comments
Closed

异步校验事件比较长的时候,错误信息无法展示 #51

bindoon opened this issue Jul 12, 2021 · 0 comments

Comments

@bindoon
Copy link
Member

bindoon commented Jul 12, 2021

在 PR https://github.com/alibaba-fusion/field/pull/47/files#diff-bfe9874d239014961b1ae4e89875a6155667db834a410aaaa2ebe3cf89820556R206 里面,本来是要修复 #45 ,把 validate 的reRender 和 onChange 的reRender 合并了。

rule && this._validate(name, rule, trigger, false);

问题复现

如果validate 立刻触发,那么onChange 在最后reRender 的时候就会把validate后的状态带出去;但是如果 validate 需要较长时间就会变成

  • onChange 的 reRender 先触发了。value 发生变化
  • validate 比如 5秒后拿到了 error 状态,onChange已经先触发了 reRender 所以错误信息无法展示。

复现demo见:https://riddle.alibaba-inc.com/riddles/dd8648b

bindoon pushed a commit that referenced this issue Jul 12, 2021
fix: should reRender after validator callback at next tick. fix #51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant