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

Sorting pagedTableTemplate incorrectly reports page number as 1 #2054

Open
hudson-newey opened this issue Apr 16, 2023 · 5 comments
Open

Sorting pagedTableTemplate incorrectly reports page number as 1 #2054

hudson-newey opened this issue Apr 16, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@hudson-newey
Copy link
Member

hudson-newey commented Apr 16, 2023

Describe the bug
When sorting a pagedTableTemplate (e.g. Audio recordings list page, my bookmarks, my projects, etc...) the page number is reset to one, when the filter applied still emits page n that the user was on before filtering.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the ecosounds audio recordings list page www.ecosounds.org/projects/1029/audio_recordings
  2. Click go to the last page on the table
  3. Sort by "Recorded", "Duration", etc...
  4. Note that the filter request emitted page 221, and you are only seeing 13 results
  5. Observe that the table now says that you are on page 1 (when you have really sorted page 221)

Expected behavior
This behavior is not seen in the batch download page as it does not use the pagedTableTemplate.

Therefore, we should either:

  1. Replicate the batch download page, and do not preserve page history while sorting. Explicitly resetting to page 1
  2. Change the pagedTableTemplate pageNumber to be dependent on the filter

Desktop (please complete the following information):

  • OS: Linux
  • Browser Firefox
  • Version 112

Additional context
The batch download page does not have this bug as it doesn't use the pagedTableTemplate:

  1. Navigate to www.ecosounds.org/projects/1029/audio_recordings/download
  2. Go to the last page (221)
  3. Filter by "Recorded" date
  4. Observe that the filter request explicitly set the page to 1
@hudson-newey hudson-newey changed the title Sorting audio recordings list table incorrectly reports page number as 1 Sorting pagedTableTemplate incorrectly reports page number as 1 Apr 16, 2023
@hudson-newey hudson-newey self-assigned this Apr 16, 2023
@hudson-newey hudson-newey added the bug Something isn't working label Apr 16, 2023
@atruskie
Copy link
Member

the correct behaviour is to reset the page

@atruskie
Copy link
Member

i just changed sort order and saw the page reset to 1... I'm not sure what you're describing?

@hudson-newey
Copy link
Member Author

hudson-newey commented Apr 17, 2023

The bug is that the table says it's on page 1, when in reality it's on page n. It's easier to see in the api filter request when you sort the page. You'll see that the sorting filter updates correctly, but the paging.page property isn't reset to page 1, it retains the page that you were on when you sent the sort request.

You'll also be able to see the bug through the steps below:

  1. navigate to the audio recordings list page https://www.ecosounds.org/projects/1029/audio_recordings
  2. Go to the last page
  3. Sort by "Duration"
  4. Note that you are on page 1
  5. Go to the last page 221
  6. Note that none of the results updated because you were actually already on the last page

e.g. The table says page 1, but the filter request was for page 221
image

Additionally, there are only 13 recordings on the "first page" (because we are still on the last page)
image

@atruskie
Copy link
Member

Okay good spot. It looks like we intend to reset the page but it's not being passed through to the request - that should make it easy to track doown.

@atruskie
Copy link
Member

I reckon we should upgrade this page to use bawDatatablePagination and see if the bug is still present. If fixed then this task becomes remove old pagination stuff throughout the client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants