-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Audit fields' behavior when setting invalid values #2462
Comments
Image specific behaviorImages should throw an error if the width or height are invalid. The src is allowed to be invalid as the browser will handle it as a broken image. |
So after #2441 all fields should work, but I think the code can be reorganized to make it better. Almost all field constructors look like this:
The problem with this is that the super-constructor calls setValue which calls doClassValidation_ which means doClassValidation_ is getting called twice. ProposalInside setValue, if doClassValidation_ returns null, and the current value is also null, use a getClassDefaultValue function to set the value. This way (almost) all field constructors would just look like this:
Making the code more organized for external developers, and more efficient.
Oh and also any Additional InformationThis may be overkill hehe. |
@BeksOmega can you check off any of these that you've already fixed, and comment on any that you know have weird behaviour? |
@rachel-fenichel As far as I know, all fields are functioning correctly. Each field type has a test suite for "Value -> New Value" which covers this issue (I went back and checked). All of those tests pass. Sadly I cannot check off the boxes because I do not have perms :/ |
Problem statement
In general, trying to set a field with an invalid value should not change the current value of the field. There are several fields that instead fall back to the default if they can't interpret the value passed in.
There are some fields where invalid values should cause errors, such as field images. Please add comments to this issue to clarify any field specific bad value handling.
Fields to review:
The text was updated successfully, but these errors were encountered: