Advanced Search locking up browser #2188
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue: Multiple Unnecessary Re-renders of ContentList on Search Execution
When the user clicks the Search button in AdvancedSearch component, the
executeSearch
function is triggered, which subsequently callsfetchResults
function within the SearchPage component. This action causes the SearchPage component to re-render, leading to multiple unnecessary re-renders of the ContentList component. Since ContentList is responsible for handling the bolding of search terms, these repeated re-renders can cause freezing the browser.Solution
To enhance performance and prevent browser freezing, we need to optimize the rendering process so that ContentList re-renders only once after the search results are fetched.
Additional Issue: Search Terms Not Saved on New Search Creation
During testing, when creating a new search, the search terms (searchTerms) are not being saved correctly. This issue occurs because searchTerms are only updated when the user clicks the Search button. We need to ensure that searchTerms are properly included when a new search is created, similar to how they are handled during updates.
Solution
Update the
addSearch
function to include searchTerms when creating a new search.