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

why form-field children of render props only work with shouldupdate? #21645

Closed
1 task done
AshoneA opened this issue Feb 27, 2020 · 2 comments · Fixed by react-component/field-form#158
Closed
1 task done

Comments

@AshoneA
Copy link
Contributor

AshoneA commented Feb 27, 2020

  • I have searched the issues of this repository and believe that this is not a duplicate.

What problem does this feature solve?

Mostly, if field-B depend on field-A, field-B need to know about field-A value, so field-B should be a render props as Field's children. Maybe I write denpendencies={['field-A']} then It should be work. But now Field children of render props only work with shouldupdate, then I need to write a function to compare the pre-value and current value, maybe dependencies should do more work for convenience。Is it designed on purpose? I read field-form code it should be fine. Like dependencies={['gender']} replace shouldUpdate={(prevValues, currentValues) => prevValues.gender !== currentValues.gender} in https://next.ant.design/components/form-cn/#components-form-demo-control-hooks.

What does the proposed API look like?

render props should work with dependencies props

@zombieJ
Copy link
Member

zombieJ commented Feb 28, 2020

dependencies is an option but we didn't export to support render props yet is wish more user feedback since API is hard to remove if added. So we provides most flex way api shouldUpdate at the beginning.

But yes, it will come if more developer want this : )

@AshoneA
Copy link
Contributor Author

AshoneA commented Feb 28, 2020

Thanks for your answer. Maybe I'm the first guy that wants this : ).
btw, the new form performance is awesome, I like it!

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

Successfully merging a pull request may close this issue.

2 participants