inveniosoftware / react-searchkit

React component library for interacting with a REST API.
https://inveniosoftware.github.io/react-searchkit/
MIT License
78 stars 40 forks source link

Change sort by/order on empty query #111

Closed ntarocco closed 3 years ago

ntarocco commented 4 years ago

The sort by/order on empty query has been removed because it was not working.

Requirements

The user should be able to set the initial state of the app and also define what is the sort by/order when the query string is empty. Example:

If the user changes and select a specific sort by/order, then her/his selection takes precedence and it is user for all queries.

On top of that, the SortOrder component was not taking into account the defaultOnEmptyQuery options. As consequence, when searching with a query or with empty query, the SortBy component changes the default value but not the SortOrder.

For example, when searching with query, the search should be probably bestmatch:asc, while when empty mostrecent:desc (newest first).