-
-
Notifications
You must be signed in to change notification settings - Fork 794
Description
Describe the bug
There is a minor bug in the global search input that causes the webpage to fetch all icons, slowing down the page and sometimes causing it to crash completely. I suspect that the user input isn't being sanitized properly (i.e., leading/trailing whitespaces aren’t being stripped) or that spaces weren’t explicitly excluded when counting characters. This results in the website fetching all icons, which puts a lot of load on the site and can cause it to crash.
Expected behavior
I expect that when I enter only spaces when searching for an icon, to see the message "Please enter at least 2 characters to search...". Although space is a character, it shouldn't be counted as it's not helpful when searching for icons. Currently it doesn't show you results for a single space character.
Minimal sample repository URL
https://react-icons.github.io/react-icons/search/
Steps To Reproduce
- Go to the preview website React Icons
- In the search bar start entering any number of spaces(minimum 2).
- You will see a few icons start to load on the right, but they aren't clickable. Also you will notice a small scrollbar on the right and when you scroll down you will see empty spaces. Also the webpage or even the browser will be unresponsive and you might see a popup modal saying "this page isn't responding".
Package version
v5.3.0
Relevant log output
No response
Additional context
While fixing this bug may not be rewarding much as I doubt anyone will just randomly enter spaces when looking for an icon, but it can improve the robustness of the application.
Quick showcase of what happens