Closed ajclaasen closed 3 years ago
@rjclaasen Sorry for the late reply. I think we can try the Math.random()
to add extra salt to the unique ID generated. Please feel free to make a PR for the changes. I would be happy to test and release a new version of the package 😊
@rjclaasen Could you create a PR for this?
Hello, and thank you for your great work on this project!
I think I have found a little bug in the
utils.js
file. If thegetUniqInputId()
is called twice within the same millisecond, it will return the same result. In that case, thegetUniqInputID()
will not return unique IDs.https://github.com/abhaynikam/react-trix-rte/blob/1e7c997eb588632deec678ed454d3b3cde8e3ad5/src/components/Shared/utils.js#L10-L13
These ID collisions can cause some issues when rendering many
<ReactTrixRTEInput>
elements at the same time.I am not very familiar with the performance constraints of this package and whether it would be worth the effort, but I think using the uuid package to generate these IDs would ensure they are unique.
Another suggestion I can think of is adding a
Math.random()
addition to salt the current implementation with a random number.Please let me know what you think of these suggestions, I would love to write a PR and help out!
Thank you again for all your work, it's been great to work with!