-
Notifications
You must be signed in to change notification settings - Fork 4.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
🪟🐛 Connector form: Remove empty strings from form values for optional properties #20808
Conversation
airbyte-webapp/src/views/Connector/ConnectorForm/components/Property/Control.tsx
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
@josephkmh glad you made the comment with the required field - the failing tests are an actual failure because if a field is set to undefined, formik will automatically fill in the default value again if there is one (this broke entering the port number in the e2e test). I fixed this case by not setting a field to undefined if there is a default value as formik will fill it in when casting so it won't send an empty string in this case either. Added it to the list of things that are annoying about formik... |
Good catch! That is a strange behavior, TIL. Never underestimate formik 😭 |
What
Fixes #8060
How
If a user is entering a value in an optional field and removes it subsequently, an empty string will reside in that property. This PR detects this situation and overrides the value with undefined in the same react commit.
This is done for regular inputs, textareas, secret inputs and textareas as well as date(-time) inputs. It does not happen for array-inputs and enums.