-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
anyOf field incorrectly updating after change #1486
Comments
Just confirming -- is the same issue is happening with the latest code on the master branch (https://rjsf-team.github.io/react-jsonschema-form/)? We added in a few changes that might have fixed it in #1352 |
Yes, when running the devserver playground of the latest version on the master branch with the changes from #1352, I still run into this problem. |
I've also found another issue that is related to the anyOf schema incorrectly rendering. I was unsure if I should make another ticket or include it in this issue. The steps to reproduce:
The expected behaviour is that the second item input should correctly update. However, the first item is updating and incorrectly at that as well. This issue has to do with the schema not re-rendering after a change because the only prop that is changing is the idSchema which is not resolved in shouldComponentUpdate here: |
Prerequisites
Description
Since updating to react 16, the anyOf field doesn't correctly update after receiving props. It will override the selected option incorrectly. This can be resolved by migrating to the componentDidUpdate method instead of the componentWillReceiveProps that's currently marked unsafe. componentWillReceiveProps will update state synchronously and componentDidUpdate will update state asynchronously.
Steps to Reproduce
Expected behavior
The array should have the two positions switched.
Actual behavior
The array only has one position switched correctly, while the other has the wrong selected option even though the state has been changed.
Version
v.1.8.0
The text was updated successfully, but these errors were encountered: