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

LXL-4457: Keep sort options when doing new searches #1086

Merged

Conversation

johanbissemattsson
Copy link
Contributor

@johanbissemattsson johanbissemattsson commented Aug 12, 2024

Checklist:

  • I have run the unit tests. yarn test:unit
  • I have run the linter. yarn lint

Description

Tickets involved

LXL-4457

Solves

Keeps sort options when doing new searches from the search result page.

This works by reusing old sort query param for new searches. Note that this doesn't involve the local storage functionality (which currently only works if the user is signed in), so the last selected sort option isn't persisted if an unauthenticated user navigates to the start page and enters a new search query.

Summary of changes

  • Use _sort value from route as preferred sort
  • Check if sort value from route query param is available for active search type

@johanbissemattsson johanbissemattsson changed the title Keep sort options when doing new searches LXL-4457: Keep sort options when doing new searches Aug 12, 2024
@johanbissemattsson johanbissemattsson marked this pull request as ready for review August 13, 2024 09:33
@jesperengstrom
Copy link
Contributor

All the sort options seems to stick except _sortKeyByLang (A-Ö, Ö-A), which keeps resetting. How come?

@johanbissemattsson
Copy link
Contributor Author

johanbissemattsson commented Aug 14, 2024

All the sort options seems to stick except _sortKeyByLang (A-Ö, Ö-A), which keeps resetting. How come?

This is resolved in 281730e where an includes() method is used instead of a strict equality check (to allow localized _sortKeyByLang keys).

Copy link
Contributor

@jesperengstrom jesperengstrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, working now. LGTM!

@johanbissemattsson johanbissemattsson merged commit d79a93d into develop Aug 14, 2024
1 check passed
@johanbissemattsson johanbissemattsson deleted the fix/LXL-4457-keep-sort-option-on-new-searches branch August 14, 2024 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants