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

Avoid duplicated names on creating components #15465

Merged

Conversation

adrinr
Copy link
Collaborator

@adrinr adrinr commented Jan 30, 2025

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 allowed

Screenshots

Screen.Recording.2025-01-30.at.16.49.09.mov

Launchcontrol

Avoid duplicated names on creating components

Copy link

linear bot commented Jan 30, 2025

Copy link

qa-wolf bot commented Jan 30, 2025

QA Wolf here! As you write new code it's important that your test coverage is keeping up.
Click here to request test coverage for this PR!

@github-actions github-actions bot added firestorm Data/Infra/Revenue Team size/s labels Jan 30, 2025
@adrinr adrinr marked this pull request as ready for review January 30, 2025 15:56
Copy link
Member

@aptkingston aptkingston left a 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 = "",
Copy link
Member

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.

Copy link
Collaborator Author

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

@adrinr adrinr changed the base branch from BUDI-9016/extract-componenterrors-from-client to master January 31, 2025 08:21
@adrinr adrinr force-pushed the BUDI-9016/avoid-duplicated-names-on-creating-components branch from 3918121 to 2f4e798 Compare January 31, 2025 08:27
@adrinr adrinr enabled auto-merge January 31, 2025 08:29
@adrinr adrinr merged commit 859894a into master Jan 31, 2025
20 checks passed
@adrinr adrinr deleted the BUDI-9016/avoid-duplicated-names-on-creating-components branch January 31, 2025 08:31
@github-actions github-actions bot locked and limited conversation to collaborators Jan 31, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
firestorm Data/Infra/Revenue Team size/s
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants