-
-
Notifications
You must be signed in to change notification settings - Fork 248
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
reset should set initial model #140
Comments
So you've tried it on Yes, it is a breaking change, but every bugfix is a breaking change because something is working differently now, doesn't it? This should behave exactly the same as the initial state in the Would you like to submit a PR for it? |
@radekmie: Yes, I can do this in the next days. But generally, you do agree with this change? |
Yes, I do agree. If you are using it in a fully automatic way (you have no model), then we are not changing anything. If you are using it as a default model, then the new behaviour is the desired one. At last, if you are using it as a managed form, then it's still OK because it'll keep the model from props. |
Available in |
I tried reset() for the first time.
It added a button to the QuickForm and called this.reset();.
It thought it would reset the state to the given props.model on the form, but instead, all fields were emptied. Shouldn't it reset to the model instead? if no model is given, then yes, it should empty all fields.
Edit:
it's on this line:
https://github.com/vazco/uniforms/blob/master/packages/uniforms/src/components/forms/AutoForm.js#L65
i think it should set it back to this.props.model instead of {},
Setting it back to props.model would be more logical to me, but this would be a breaking change. Opinions?
The text was updated successfully, but these errors were encountered: