Skip to content

Commit

Permalink
LXL-4457: Keep sort options when doing new searches (#1086)
Browse files Browse the repository at this point in the history
* Use _sort value from route as preferred sort

* Check if sort from query param is available for active search type

* Use includes instead of strict equality check to allow localized _sortKeyByLang
  • Loading branch information
johanbissemattsson authored Aug 14, 2024
1 parent 170a871 commit d79a93d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions vue-client/src/components/search/search-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,14 @@ export default {
return { '@type': type };
},
prefSort() {
if (
this.$route.query?._sort
&& this.settings.sortOptions[this.activeSearchType]
?.find((sortOption) => this.$route.query._sort.includes(sortOption.query))
// use includes instead of strict equality check to allow localized _sortKeyByLang (e.g. _sortKeyByLang.sv)
) {
return { _sort: this.$route.query._sort };
}
if (this.user && this.user.settings.sort) {
const availableSorts = this.settings.sortOptions[this.user.settings.searchType];
Expand Down

0 comments on commit d79a93d

Please sign in to comment.