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

[react-search-ui] setSort not working, Sorting not working #1109

Closed
craquet opened this issue Feb 7, 2025 · 1 comment · Fixed by #1112
Closed

[react-search-ui] setSort not working, Sorting not working #1109

craquet opened this issue Feb 7, 2025 · 1 comment · Fixed by #1112
Assignees
Labels
bug Something isn't working tracking Adding issue to project board

Comments

@craquet
Copy link

craquet commented Feb 7, 2025

Describe the bug
The SearchContext of react-search-ui provides a method called setSort to sort the results. It provides a signature for setting the sorting like this:

search.driver.setSort("field", "asc") // Version 1

and like this:

search.driver.setSort([{ field: "field", direction: "asc" }], "asc") // Version 2

There are two problems here

  1. When specifying the sort using Version 1, it does not work (does nothing, as described in Can't get sorting to work #932 , which is closed but not fixed)
  2. When specifying the sort using Version 2, the second parameter ("asc") is obsolete and should not have to be specified. Though I assume it has no effect anyways.

To Reproduce

Expose the search context to the window object and try the above methods using the browser console. Using Version 1 will update the state, but will not issue a new search. Version 2 works, although the method signature is wrong.

Also See #932 as this issue also applies here (the Sorting component does not work).

Expected behavior
Version 1 and Version 2 as outlined above should work as expected and issue a new search with the correct sorting.

The Sorting component should behave as expected and issue a new search when a sort option is selected.

Related
See also #932

Which backends and packages are you using:
Backend: [Elasticsearch]
Packages: [react-search-ui]

@craquet craquet added the bug Something isn't working label Feb 7, 2025
@yansavitski yansavitski added the tracking Adding issue to project board label Feb 17, 2025
@sphilipse
Copy link
Member

Hi @craquet! Thanks for reporting this bug, we'll prioritize this and try to fix it. I can't promise a definite date by which this will be fixed, but it's definitely on our radar.

@yansavitski yansavitski self-assigned this Feb 21, 2025
@yansavitski yansavitski linked a pull request Feb 21, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tracking Adding issue to project board
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants