fix: restore search history and suggestions in Autocomplete dropdown - #456
Open
Sumit-ai-dev wants to merge 1 commit into
Open
fix: restore search history and suggestions in Autocomplete dropdown#456Sumit-ai-dev wants to merge 1 commit into
Sumit-ai-dev wants to merge 1 commit into
Conversation
- Add missing onChange handler (handleOptionSelect) to Autocomplete component so clicking a dropdown item correctly fires a search - Merge searchHistory and live suggestions into a single deduplicated options array so both appear in the dropdown - Remove broken suggestions.includes() guard from handleAutocompleteChange that was preventing history items from triggering searches - Re-enable enableSuggestions flag in search-config.js now that the underlying React event wiring is correct Fixes the bug introduced during the FlexSearch refactor (PR StatTag#281) where selecting an item from search history would show 0 results.
Contributor
Author
|
Hey @lrasmus! The PR is up and ready for review whenever you have a chance. Happy to tweak or change anything if you need me to! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Prerequisites
Expected Behavior
Clicking an item from the Search History or live suggestions dropdown fires the search and loads results instantly.
Current Behavior
enableSuggestionsis disabled insearch-config.jsbecause clicking a dropdown item updates the text box but the search never runs; you just get 0 results. On top of that, thesearchHistoryarray wasn't even being shown in the dropdown.Possible Solution
<Autocomplete>fires two separate events —onInputChangefor typing andonChangefor clicking. OnlyonInputChangewas wired up, so clicks on dropdown items were completely ignored.handleOptionSelectand wired it toonChangeso clicking a suggestion actually triggers the search.searchHistoryinto the dropdownoptionsalongside live suggestions (deduplicated withSet) so history items actually show up.suggestions.includes()guard that was silently blocking history items from ever running a search.enableSuggestions: trueinsearch-config.jsand cleaned up the TODO comment.Fixes #455
Your Environment
Screenshots
1. Search history properly showing in the dropdown after re-enabling the feature:

2. After clicking 'Data' from the history dropdown, the search instantly executes and loads the results instead of showing 0 results:
