Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR fix?
Notes and Research
The Freezing
Upon investigating the freezes, I tested with some debounce hooks to see if it fixes the issue, which It did. Testing with different delays it seems like it worked with the most minimal delay (0.1), In the code I am providing, I used a simple
setTimeout
with a delay of 0.1. The risk of a memory leak is very minimal, but I recommend a full-fledged debounce hook with a cleanup function if used in production. This stops the freezing, although it does get a bit laggy if you do end up spamming for quite a while.The space bug
The code provided successfully identifies the spaces or whitespace and adds it to the render condition; it also trims out the value if you do have some whitespace, you're still able to add labels with a space and trims it upon creating a new label.
Demonstration
Testing spam freezes
chrome_3oHVmdHvep.mp4
Testing space bug
chrome_P305WgxSAy.mp4