refactor: generate new unique name until unknown#1352
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 |
|
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