-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Avoid duplicated names on creating components #15465
Avoid duplicated names on creating components #15465
Conversation
QA Wolf here! As you write new code it's important that your test coverage is keeping up. |
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! We can keep things simpler by not needing the separator param 👍
@@ -76,13 +76,15 @@ export const getSequentialName = <T extends any>( | |||
{ | |||
getName, | |||
numberFirstItem, | |||
separator = "", |
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.
The way to handle a space is just to include a space in the prefix - so just add a space to the end of New ${definition.friendlyName || definition.name}
down below and it has the same effect without needing a separator param 👌 This util is written to trim the prefix and handle it properly when looking for existing names.
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.
This was my initial approach, but I felt it was confusing. I set that the prefix (aka the name I actually want) with the whitespace, but the result is without the whitespace if there is a count. As a user, I would expect to respect the whitespace by default
3918121
to
2f4e798
Compare
Description
Add a counter to the
New whatever
component name to avoid creating multiple items with the same name. We don't validate that they are not called the same, so any existing duplicates or renaming to have the same duplicates will be allowedScreenshots
Screen.Recording.2025-01-30.at.16.49.09.mov
Launchcontrol
Avoid duplicated names on creating components