Skip to content
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

Keyword in Search Box Redirect Issue #69

Open
LTR14 opened this issue Jun 30, 2023 · 0 comments
Open

Keyword in Search Box Redirect Issue #69

LTR14 opened this issue Jun 30, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@LTR14
Copy link
Collaborator

LTR14 commented Jun 30, 2023

Source: (read-in-spreadsheet branch) PPUC/frontend/src/components/Commentary.jsx and PPUC/frontend/src/components/Researchers.jsx

Description: When clicking a keyword in the search box, it will redirect to the Researchers.jsx component but it will not enter the search. The keyword will fill the search box but the user will have to manually hit enter to see results on the second page.

To Reproduce: Click any keyword from the category box. Make a note of the URL and that the keyword appears in it and in the search bar itself. Hit enter or the arrow on the search bar

Solution: One thought about this issue comes from this section of code in Researchers.jsx
const queryParams = QueryString.parse(this.props.location.search); if (queryParams.search) { this.setSearchQuery(queryParams.search, true); }
If you console log queryParams this shows the right value but then after the setSearchQuery call, this.props.searchQuery does not get updated (again can be seen by console logging immediately after the call is made). I believe this has to do with the "true" parameter being sent to the set function, which redirects to the handleSearch function. Changing true to false is one theory to fix it, but that would then interfere with the scrolling and highlighting feature. In debugging this issue, this is the first area to look at as well as what is being sent to handleSearch()/ why searchQuery is not being initialized with this.

Another idea would be to go to the location in Commentary.jsx that handles the links for these keywords and attempt to do two function calls, one for handleSearch() and another for setSearchQuery on the keyword itself. Issue with this is the href being using and onClick

@LTR14 LTR14 added the bug Something isn't working label Jun 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant