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: prevent variant name from containing extra whitespace #3777

Merged
merged 2 commits into from
May 16, 2023

Conversation

sighphyre
Copy link
Member

What

This trims off the white space surrounding a variant name when adding/editing a variant.

Why

The behaviour here differs from feature toggle add/update. This patches the behaviour on variants to bring this inline with adding/updating a feature toggle name.

Variant names need to be URL safe, while we do get a nice error message back, we know on the frontend that a variant name with a white space buffer will fail. This should block the user from the most obvious ways of inputting text that will fail

@sighphyre sighphyre requested a review from nunogois May 15, 2023 13:36
@vercel
Copy link

vercel bot commented May 15, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 16, 2023 9:06am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) May 16, 2023 9:06am

@github-actions
Copy link

After enabling strictNullChecks this PR would be increasing the number of null check errors from to .
Make sure your branch is up-to-date with main and check the diff in the console output to pinpoint the offending files.

1 similar comment
@github-actions
Copy link

After enabling strictNullChecks this PR would be increasing the number of null check errors from to .
Make sure your branch is up-to-date with main and check the diff in the console output to pinpoint the offending files.

Copy link
Member

@nunogois nunogois left a comment

Choose a reason for hiding this comment

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

LGTM, however I would like to see a smarter behavior like it's described in the task: https://linear.app/unleash/issue/2-1052/bug-variants-name-with-space-in-the-name-return-error-on-save

This approach doesn't cover some edge cases, and in general it would be better to warn the user of an invalid variant name right away instead of allowing the user to save and only then providing an error, therefore losing the edited data.

@sighphyre
Copy link
Member Author

LGTM, however I would like to see a smarter behavior like it's described in the task: https://linear.app/unleash/issue/2-1052/bug-variants-name-with-space-in-the-name-return-error-on-save

This approach doesn't cover some edge cases, and in general it would be better to warn the user of an invalid variant name right away instead of allowing the user to save and only then providing an error, therefore losing the edited data.

Fair enough! Unpacked a little elsewhere, sounds like we should do a second pass at this to improve this app wide but this should still be merged

@sighphyre sighphyre merged commit 4790a26 into main May 16, 2023
16 checks passed
@sighphyre sighphyre deleted the fix/variant-name-allows-terminating-spaces branch May 16, 2023 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants