-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes: #2062: Search bar fires a request on every entered letter #2066
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Go to search and open the network tab. You will notice that you are firing requests even without typing.
This is another bug that we already fixed a long time ago.
That's really weird. The search bar should be calling the search service instead of the posts service anyway so that's not the intended behaviour and is unrelated to this PR. That said, your image is indicating that the posts service was unable to find the post instead of showing the search query server error message which is weird |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm seeing what @PedroFonsecaDEV mentioned in his comment before. It seems that the page keeps sending requests infinitely after hitting enter. We had this bug before, but we fixed it. Maybe it's possible to check the history to see how we fixed it.
I think the Vercel search issue is related to staging/dev running the back-end on the same origin, so |
Tested #2075 and the search page was working fine. Gonna wait for that to be merged in so I can rebase that in here and see if that does the trick |
@HyperTHD don't rebase using GitHub. Merge in your local machine then push the rebase version.
|
Rebased a PR with fix for issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great.
Issue This PR Addresses
Fixes #2062
Type of Change
Description
I landed #2046 to create a search context. There was a bug I didn't catch where it would create a request on every entered letter instead of just waiting until the user press the enter key or clicks the search button.
I included the textParam as a value in the SearchProvider which will ensure that SearchResults.tsx uses that property instead of text. Since the text value gets updated everytime a letter is entered, it would fire the async request to search for a post.
Checklist