-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: auto-switch to relevance sort when search query is entered #778
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
Closed
oolong-tea-2026
wants to merge
2
commits into
openclaw:main
from
oolong-tea-2026:fix/search-sort-relevance
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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.
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.
Manual sort override silently ignored while searching
The new logic unconditionally returns
'relevance'wheneverhasQueryis true, meaning the sort dropdown becomes non-functional during an active search. When a user selects'downloads'or'stars'from the dropdown while searching,onSortChangewritessearch.sortto the URL, but the computedsortalways evaluates to'relevance'regardless — the actual sort used never matches the user's selection.The PR description's "After" column states the manual sort selection is "Respected", but the code contradicts this. The original code correctly threaded
search.sortthrough for any manually-chosen value while a query was active; only the implicit default was broken.To preserve the ability to manually override the sort during search, the auto-switch to relevance should only apply when
search.sorthas not been explicitly set by the user (i.e. when it isundefined). ThebeforeLoadinjection ofsort=downloadsinto the URL on cold page loads would still bypass this intent, which is a related but separate root-cause issue worth addressing alongside this fix.Prompt To Fix With AI
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.
Good catch! Fixed in fdf9654. The new approach: onQueryChange clears the URL sort param when entering a search query (so
search.sort ?? 'relevance'kicks in as default), but manual dropdown selection writes to search.sort and takes precedence. This preserves user overrides while fixing the original bug where beforeLoad-injectedsort=downloadspersisted through search.