Skip to content
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

Merged
merged 8 commits into from
Jan 3, 2023

Conversation

flash1293
Copy link
Contributor

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.

@octavia-squidington-iv octavia-squidington-iv added the area/platform issues related to the platform label Dec 22, 2022
@flash1293 flash1293 marked this pull request as ready for review December 22, 2022 11:20
@flash1293 flash1293 requested a review from a team as a code owner December 22, 2022 11:20
Copy link
Contributor

@josephkmh josephkmh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@flash1293
Copy link
Contributor Author

@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...

@josephkmh
Copy link
Contributor

Good catch! That is a strange behavior, TIL. Never underestimate formik 😭

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/frontend Related to the Airbyte webapp area/platform issues related to the platform team/extensibility
Projects
None yet
3 participants