Why would you ever want a UUID in the form of a number array?
In the latest release: version 2.0.0, the type signature of the return parameter in the v4 UUID function changed from string to string | number[]. Why? I'm curious what use case would require the UUID to be represented as a number array? As the change in the return signature is breaking for typescript projects that depend on the typed return signature. (which could be interpreted from the major release bump)
Hey @saltz idea behind number[] was to make it backward compatible with the ArrayBuffer and a choice went to going with number[] as a simplified version of bytes array that was used in the original version of uuid.
I'm working on a new native implementation right now, so I'd love to know more about your use case.
I get the point about that string | number[] is confusing. I'll probably refactor those into two separate functions too.
This signature totally breaks my usage of UUIDs. A lot of places expect UUIDs to be a string, a common one is <Component key={uuid} /> which is now broken.
Thanks for reporting Daniel. I’ve new version in the works. Should be released this weekend.
On Thu, May 27, 2021 at 7:57 AM Daniel van der Merwe < @.***> wrote:
This signature totally breaks my usage of UUIDs. A lot of places expect UUIDs to be a string, a common one is <Component key={uuid} /> which is now broken.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/eugenehp/react-native-uuid/issues/16#issuecomment-849704803, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOFN3Y74VQUKVER4EEBZV3TPZMT7ANCNFSM44G6PAQA .
This is going to be a part of 2.0.2
Thanks!
@eugenehp is there any update on when 2.0.2 will be released?
Hey Katia,
I’ve got a refactored version ready, but need to run more tests this weekend and then push to the NPM.
On Fri, Jun 11, 2021 at 12:34 PM Katia Wheeler @.***> wrote:
@eugenehp https://github.com/eugenehp is there any update on when 2.0.2 will be released?
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/eugenehp/react-native-uuid/issues/16#issuecomment-859796957, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOFN3ZK7AYPLC2NHJNOX3LTSJQMVANCNFSM44G6PAQA .
Ok, have a fresh version refactored! Going to do some more tests this week with a planned release for the weekend.
@eugenehp any update on this or any way that I can help assist in testing?
Thanks @katiawheeler I've a drafty new version ready, I'll circle back for your feedback in the next few days.
I've also found a new way to optimize and ensure cryptographic stability, but that will come later in a next major release 🚀
alright, good news is that we've made some progress, bad news is that it's new branch, and not the current release. I plan to get a little bit more time next week to work on this, and will try to do a pre-release and could use some help to do the testing.
@eugenehp happy to provide assistance where I can!
I was curious to see what kind of benefit string | number[] would provide. It'd be nice to see this in the README Doc.
Thanks Leonard. You are right. That was an effort to sort out the types and provide a better flexibility on how to consume it.
It sucked and it didn’t result in what most of the devs wanted.
So I’m working to get back the updated version with a single type return.
Would you be down to do the early tests and give some feedback?
On Sat, Oct 2, 2021 at 9:11 PM Leonard Choo @.***> wrote:
I was curious to see what kind of benefit string | number[] would provide. It'd be nice to see this in the README Doc.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/eugenehp/react-native-uuid/issues/16#issuecomment-932859352, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOFN3Z2XUMVJQUKBEV7BVTUE7JVNANCNFSM44G6PAQA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
@eugenehp Sure! How could I help? I'm an entry level dev so I'm not super experienced but I'd be happy to help.
@eugenehp Hi! Is there any progress on this? Is the current recommended usage to cast uuid.v4() to string?
Hey Martin,
Thanks for bumping this up. There’s a draft version. Need to test it more this weekend.
Would you be available to run few tests on your side?
Eugene
On Tue, Jan 11, 2022 at 3:46 AM Martin Akre Midtsund < @.***> wrote:
@eugenehp https://github.com/eugenehp Hi! Is there any progress on this? Is the current recommended usage to cast uuid.v4() to string?
— Reply to this email directly, view it on GitHub https://github.com/eugenehp/react-native-uuid/issues/16#issuecomment-1009884931, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOFN3YG6UTQSWM7W3VPAHTUVQKCXANCNFSM44G6PAQA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you were mentioned.Message ID: @.***>
@eugenehp That sounds great! Of course, just ping me and I will assist with what I can.
Hi @eugenehp ,
Thanks for this awesome library. Any updates with the draft version ?
Best regards
Any update on this?
If anyone is still stuck on this, I just switched to using uuid, @types/uuid, and react-native-get-random-values polyfill which works as expected.
@eugenehp
With a little function overloading, the return type can be inferred from the arguments.
let result1: string = uuid.v4()
let result2: number[] = uuid.v4(undefined, [1, 1], undefined)
I made a mock example at the typescript playground.
Here's my workaround for manipulating uuid's string:
const uniqueId = uuid.v4()
const editedUuid = typeof uniqueId === 'string' ? uniqueId.replace(/-/g, '') : ''
If someone has a better idea, a flag or something, please tell me
upping this case @eugenehp, I can see that there is 2 years of discussion on the subject 💀 Is it still in work or do some help are still required on this subject ?
Also a simple workaround could be to break it into two function, one for string and one for array number, as we want to avoid to have any params to provide
Surprised and confused to stumble upon this problem and GitHub issue. A uuid is uncontroversially a string. This problem seems to have arisen from poor dev decisions, but it is shocking that it has been unresolved for so long.
@eugenehp Do you have any response as to if/when this will be fixed?
@eugenehp any update on this?
@eugenehp, any updates??