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

fix(Form):An uncontrolled situation about formError #379

Merged
merged 1 commit into from Jan 24, 2019

Conversation

@Sleaf
Copy link
Contributor

commented Jan 24, 2019

No description provided.

@simonguo

This comment has been minimized.

Copy link
Member

commented Jan 24, 2019

@Sleaf 你不更新 state ,始终解决不了 props 的 formError 更新为 {} 以后, 会去取 state 中的 error 。

@Sleaf

This comment has been minimized.

Copy link
Contributor Author

commented Jan 24, 2019

@Sleaf 你不更新 state ,始终解决不了 props 的 formError 更新为 {} 以后, 会去取 state 中的 error 。

现在的代码逻辑是

  • 存在props.formError: 不维护state.formError,每次都是读取props.formError并通过onCheck回传校验结果
  • 不存在props.formError: 使用state.formError进行error状态保存,并通过onCheck回传校验结果。

所以如果父节点传入formError的话应该是不需要更新组件内state了吧?

@simonguo simonguo merged commit 4bf1bd5 into rsuite:master Jan 24, 2019
2 checks passed
2 checks passed
codebeat Target branch is not tracked
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.