ElliotForWater / elliotforwater.com

Webapp which run the https://elliotforwater.com/ website
https://elliotforwater.com/
MIT License
15 stars 13 forks source link

fix: searching # returns to homepage #118

Closed mintbomb27 closed 3 years ago

mintbomb27 commented 3 years ago

Related Issue

74

Description

Before, searching "#" would lead back to the homePage, and searching "&" would lead the rest of the query to disappear. The same issue was there for suggested searches as well. Now, the URL query is encoded, and leads to give the proper search results, as well as suggestions.

Search Results: Couldn't show the search results as I wasn't able to get the API up, because of missing env keys. Before:

Screenshot 2021-09-03 at 9 30 43 PM

After:

Screenshot 2021-09-03 at 9 30 26 PM

Search Suggestions: Before:

Screenshot 2021-09-03 at 9 29 26 PM

After:

Screenshot 2021-09-03 at 9 29 40 PM

Impacted Areas in Application

searchBar.tsx for the search suggestions, and _utils.tsx containing the queryNoWitheSpace() function.

Steps to Test or Reproduce

Search for something containing #, or even &.

Related PRs

None


PR Checklist:

gsambrotta commented 3 years ago

Thank you @mintbomb27 for your PR!! that's very helpful! I checked with real API and everything works great. :tada:

Btw, you can see here https://github.com/ElliotForWater/elliotforwater.com/wiki/1.-Set-up-and-usage how to mock API and our CMS. No need to have API env key :)

gsambrotta commented 3 years ago

@mintbomb27 we would like to mention you on our twitter to officially thank your contribution. Do you have twitter handler?

mintbomb27 commented 3 years ago

Hey yeah sure! Its mintbomb27. This was my first open source contribution and thanks a lot for accepting it!