-
Notifications
You must be signed in to change notification settings - Fork 90
refactor: generate new unique name until unknown #1352
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
Conversation
error 'paths' is never reassigned. Use 'const' instead prefer-const
|
Thank you for addressing this issue.
Is going to keep appending Without it, the |
|
I agree with @derwehr , another thing that bugs me a little bit is the function name. It does not really generate unique names but rather append numbers at the end of the title (if the generated string was really unique then we wouldn't need the while loop). Regarding the while loop, isn't better to have a sort of escape hatch? |
It is correct that is keeps adding |
Correct, the name is misleading. What it does is simply adding stuff and the caller can call it as often needed to finally get a unique name. The uniqueness needs to be checked by the caller. The function doesn't know what is known already, Does it help to rename the function to something like Helpers.
Mhh, not sure if this is needed. The caller could is in charge. We could add a limit, but honestly it should not matter.. I think.. |
Hmm, how about using a timestamp, a UUID, or just some random string instead? |
Shouldn't generate _3 in the next call? given that it is detecting if was already slugfied with this regex?
It would be an option but then I would rather start thinking about properly using the thing id (since it was not used because less human-readable than then title). |
|
Not sure now how we proceed best. Let me summarize my thinking.
All this makes me think that we might want to remove the helper method and each binding can take care. If it were me, I would
No need for this method at all. Thoughts? |
|
@egekorkan mentioned that yet another possibility would be to refuse such TDs to be loaded/served. @RobWin Out of curiosity, do you have the same situation? What happens if the runtime is asked to serve TDs that use the same |
relu91
left a comment
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.
As discussed internally, I think the short-term goal is to solve #1351 . The current changes sufficiently cover the use case, in the future we will explore an id based paths.
|
Closed in favor of #1375 |
I changed
"_2"to"_"since a third time it is no longer "2"Helpers.generateUniqueName(...)to use the same pattern@derwehr
fixes #1351