fix(theme/bootstrap): redirect empty search to the home view#3176
Merged
Conversation
Submitting the SPA search form with a blank query and no conditions (e.g. a sort/num/lang-only URL such as /search?num=10) left the previous query's results rendered on screen. runFromUrl() returned early without re-running a search, and because the results view is re-rendered only by runSearch() while neither showView() nor clearSearchState() clears the results DOM, the stale results stayed visible even though the URL carried no query or filter. Mirror the classic server-side behavior, where SearchAction.doSearch() redirects a blank query with no conditions to the top page via redirectToRoot(): navigate to "/" from runFromUrl() (using history replace so the empty /search entry is not left in the back/forward stack) instead of silently leaving the stale results rendered.
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.
Summary
Submitting the SPA search form with a blank query and no conditions (e.g. a sort/num/lang-only URL such as
/search?num=10) left the previous query's results rendered on screen.runFromUrl()returned early without re-running a search, and because the results view is re-rendered only byrunSearch()while neithershowView()norclearSearchState()clears the results DOM, the stale results stayed visible even though the URL carried no query or filter.This mirrors the classic server-side behavior, where
SearchAction.doSearch()redirects a blank query with no conditions to the top page viaredirectToRoot().runFromUrl()now navigates to/(using history replace, so the empty/searchentry is not left in the back/forward stack) instead of leaving the stale results rendered. Searches that carry a keyword, afields.*filter, a full geo point, or anex_qare unaffected.Testing
node --checkon the modified assetBundledBootstrapThemeTest(120 tests) passes