-
-
Notifications
You must be signed in to change notification settings - Fork 495
fix(useField): Fix no re-render on initialValue change #1034
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
Conversation
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit fe2fb36:
|
bslipek
commented
May 25, 2023
IMO this is fine, you should not listen for initialValues after form initialization. Why you need this?
@bslipek In data driven forms (Ref: https://github.com/data-driven-forms/react-forms ) for conditionally hiding the fields, the fields are wrapped with a Field component so that they get re-rendered when the value in any of the parent attribute change(Ref: https://github.com/data-driven-forms/react-forms/blob/84c4cb8861d689cb87ba68100fe7d3acfd667655/packages/react-form-renderer/src/form-renderer/render-form.js#L47). So, due to the above issue the conditional visibility doesn't works if we reverse the order of the fields(Ref: https://stackblitz.com/edit/1dkk8s-rd1ejn?file=schema.js).
I got your point. But still think that this is not final-form problem. But I am just a observer here :)
EndMove
commented
Apr 14, 2025
Everything is in the name of the props "initialValue"
Currently useField doesn't retriggers properly if the initialValue is changed (Added test scenario).
Added explicit check for initial value change to prevent deepEqual overheads.