Skip to content

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

Closed
@craquet

Description

@craquet

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]

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtrackingAdding issue to project board

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions