Hacktoberfest-2020-Emojipedia icon indicating copy to clipboard operation
Hacktoberfest-2020-Emojipedia copied to clipboard

NLSteveO/fix search field missing some results

Open NLSteveO opened this issue 5 years ago • 2 comments

Using the global flag for RegExp will advance the lastIndex property of the regExp when test returns true and resets lastIndex to zero when test returns false.

This works better when searching one large string and you want to find multiple results without getting the same result over and over. In the use case for Emojipedia we want the lastIndex to reset to zero because regExp will be searching a new string as we filter the list and so we want it to check from the beginning of each string.

NLSteveO avatar Oct 04 '20 15:10 NLSteveO

@RishabhDevbanshi i noticed more people are creating issues recently so i'm wondering if you'd like me to create one to capture this in the mean time to help with getting this PR done? It's a small bug i noticed after creating my other PR #106 to add a few emojis but i'm not as concerned with that PR now, i'd just like to help fix the search bar mostly.

NLSteveO avatar Oct 08 '20 02:10 NLSteveO

@RishabhDevbanshi i noticed more people are creating issues recently so i'm wondering if you'd like me to create one to capture this in the mean time to help with getting this PR done? It's a small bug i noticed after creating my other PR #106 to add a few emojis but i'm not as concerned with that PR now, i'd just like to help fix the search bar mostly.

You can work on it.

RishabhDevbanshi avatar Oct 08 '20 02:10 RishabhDevbanshi