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

Bug: Sortable project solutions stay on same page number when changing sort #4347

Open
2 of 3 tasks
JustWaveThings opened this issue Jan 18, 2024 · 3 comments
Open
2 of 3 tasks
Labels
Status: Needs Review This issue/PR needs an initial or additional review Type: Bug Involves something that isn't working as intended

Comments

@JustWaveThings
Copy link
Contributor

Checks

  • I have thoroughly read and understand The Odin Project Contributing Guide
  • The title of this issue follows the Bug: brief description of bug format, e.g. Bug: Lesson complete button does not update on click
  • Would you like to work on this issue?

Bug description

When there is pagination in the project list, changing the sort by doesn't take the user to, for example, 'the most liked' projects. It applies the sort correctly but stays on the current page.

You can see I'm on page 2, and I've changed my sort to 'most liked', but I'm still on page 2, not seeing the most liked, which are on page 1.
image

How to reproduce

  1. sign in.
  2. visit starting point
  3. change sort to 'most liked'
  4. observe that the URL updates to sort=likes_count but is still on page 2, not showing the most liked. after sort change

Expected behavior

  1. sign in
  2. visit starting point
  3. change sort to 'most liked'
  4. page shows the most liked on page 1

What browsers are you seeing the problem on?

Chrome

What OS are you using?

MacOS

Discord Name

Fred | Blog API

Additional Comments

I love the feature, and I'm making the assumption here that this is not the desired behavior. If it is, It's not a big lift to manually click the page number to navigate to.

@JustWaveThings JustWaveThings added Status: Needs Review This issue/PR needs an initial or additional review Type: Bug Involves something that isn't working as intended labels Jan 18, 2024
@KevinMulhern
Copy link
Member

Thanks @JustWaveThings, this is a great point!

I'm leaning towards always going back to the start when the sort is changed. I can see some benefit in maintaining your position in the list within the pagination. But going back to the start seems like it would be more useful with the sort options we make available.

I wouldn't mind getting some third and fourth opinions about it before going ahead though aha.

Extra

It won't be hard to do - we're handling the params for the sort here. If pagination has been used, the page param will be implicitly merged into the selected sort params and sent over the wire together. If we want the sort to always go back to the start, we can do that by explicitly overriding the page param with page: 1 as one of the params.

@luuu-xu
Copy link
Contributor

luuu-xu commented Jan 26, 2024

@KevinMulhern I think it would make more sense to jump to page 1 whenever a sorting change is made by the user too. Because whenever users change the sorting rule, they are definitely expecting to view the data from page 1 again. (At least in my case!)

@JustWaveThings
Copy link
Contributor Author

I am sorry I did't catch this when you were looking for people to review it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Review This issue/PR needs an initial or additional review Type: Bug Involves something that isn't working as intended
Projects
Status: 📋 Backlog / Ideas
Development

No branches or pull requests

3 participants