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

Experimentally hide the Name and Company Name fields on the signup page #15622

Merged
merged 2 commits into from
Aug 15, 2022

Conversation

lmossman
Copy link
Contributor

What

Resolves https://github.com/airbytehq/airbyte-cloud/issues/1430

How

This PR adds logic to hide the Full Name and Company Name fields on the signup page based on respective feature flags in LaunchDarkly.

When these fields are hidden, users will be created with empty strings set for both the name and company name columns on the user record. The backend handles this gracefully, and in the case of an empty company name it uses the email as the name of the workspace created for the new user.

Example screenshot of the signup page with both fields set to hidden in LaunchDarkly:
image

@lmossman lmossman requested a review from a team as a code owner August 12, 2022 19:22
@lmossman lmossman requested a review from timroes August 12, 2022 19:23
@github-actions github-actions bot added area/platform issues related to the platform area/frontend Related to the Airbyte webapp labels Aug 12, 2022
Copy link
Contributor

@edmundito edmundito left a comment

Choose a reason for hiding this comment

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

Some comments to simplify things. I haven't tested but I'm assuming that when submitting the form the name and companyName get set to an empty string when creating the user?

Comment on lines +10 to +11
"authPage.signup.hideName": boolean;
"authPage.signup.hideCompanyName": boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

👍🏼 Easier to set up experiments if hide is set to true over show set to false

"authPage.signup.hideCompanyName"
);

const SignupPageValidationSchema = yup.object().shape({
Copy link
Contributor

Choose a reason for hiding this comment

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

var name should be camel case, not sure why it was pascal case in the first place.

Comment on lines 203 to 206
const { hideField: hideName, fieldSchema: nameSchema } = useExperimentallyHiddenField("authPage.signup.hideName");
const { hideField: hideCompanyName, fieldSchema: companyNameSchema } = useExperimentallyHiddenField(
"authPage.signup.hideCompanyName"
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be simpler to set the validation schema as a memo, for example:

const hideName = useExperiment("authPage.signup.hideName", false);
const validationSchema = useMemo(() => {
   const shape = { /* the initial values */ };
   if (!hideCompanyName) shape.name = yup.string();
   return yup.object().(shape);
}, [hideCompanyName]);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion! I think this approach is a lot simpler

<NameField />
<CompanyNameField />
</RowFieldItem>
{(!hideName || !hideCompanyName) && (
Copy link
Contributor

Choose a reason for hiding this comment

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

Another possible way to avoid checking for nots so often. Positive can be easier to read.

const showName = !useExperiement("authPage.signup.hideName", false);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah it was starting to feel like too many nots, so what you suggested is probably a better approach

@lmossman
Copy link
Contributor Author

I haven't tested but I'm assuming that when submitting the form the name and companyName get set to an empty string when creating the user?

That is correct!

Copy link
Contributor

@edmundito edmundito left a comment

Choose a reason for hiding this comment

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

🎉

I did not test this locally.

@lmossman lmossman merged commit ef7f1a0 into master Aug 15, 2022
@lmossman lmossman deleted the lmossman/experimentally-hide-name-and-company-name branch August 15, 2022 16:46
rodireich pushed a commit that referenced this pull request Aug 20, 2022
…ge (#15622)

* Experimentally hide the Name and Company Name fields on the signup page

* refactor validation schema
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants