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

fix: options value can't contain special characters #3738

Merged
merged 4 commits into from
Feb 5, 2024

Conversation

magrinj
Copy link
Member

@magrinj magrinj commented Jan 31, 2024

When we put special characters like emoji inside options, the value generated by the front-end should strip the special characters and accents.

Fix #3296

@magrinj magrinj marked this pull request as ready for review January 31, 2024 17:30
@@ -5,8 +5,19 @@ import { Field } from '~/generated-metadata/graphql';

import { FieldMetadataOption } from '../types/FieldMetadataOption';

const getOptionValueFromLabel = (label: string) =>
toSnakeCase(label.trim()).toUpperCase();
const getOptionValueFromLabel = (label: string) => {
Copy link
Member

Choose a reason for hiding this comment

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

it would be great to add tests on this function

Copy link
Member

Choose a reason for hiding this comment

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

@charlesBochet I've added some tests, let me know if it's what you had in mind and if we can merge

Copy link
Member Author

Choose a reason for hiding this comment

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

@Weiko Thanks for the tests, I've just added an emoji test

Copy link
Member

@charlesBochet charlesBochet left a comment

Choose a reason for hiding this comment

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

Let's go! LGTM :)

@charlesBochet charlesBochet merged commit a802338 into main Feb 5, 2024
13 checks passed
@charlesBochet charlesBochet deleted the fix/options-value branch February 5, 2024 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Field name and options should be normalized to A-Z+0-9
3 participants