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

[Task]: Fix pagination reset issue #1505

Closed
rylew1 opened this issue Mar 20, 2024 · 4 comments · Fixed by #1512
Closed

[Task]: Fix pagination reset issue #1505

rylew1 opened this issue Mar 20, 2024 · 4 comments · Fixed by #1512
Assignees
Labels
project: grants.gov Grants.gov Modernization tickets

Comments

@rylew1
Copy link
Contributor

rylew1 commented Mar 20, 2024

Summary

Problem: If the number of pages reduces when query parameters are changed, it is possible for the currently viewed page number to be higher than the new query's max number of pages.

Solution: Regardless of which page number the user is currently viewing, when they change any status, filter, query terms, or sorting option, the UI should:

  • Search the API with the new criteria but page_offset reset to 1
  • Reset the pagination's current page to 1
  • Clear the pagination query param (if it exists / they were viewing a page >1 before changing their query)

Secondary problem: The pagination state also has to be lifted to fix the top and bottom pagination being out of sync

Acceptance criteria

  • Pagination properly "reset" to page 1 when new results
  • Top and bottom pagination in sync
@rylew1 rylew1 added the project: grants.gov Grants.gov Modernization tickets label Mar 20, 2024
@rylew1 rylew1 self-assigned this Mar 20, 2024
@rylew1 rylew1 changed the title [Task]: Fix pagination reset bug [Task]: Fix pagination reset issue Mar 20, 2024
@rylew1
Copy link
Contributor Author

rylew1 commented Mar 20, 2024

cc @andycochran - if you have a moment, double check that the criteria above makes sense for a "pagination reset". Note that the API call for search results will be grabbing page 1 of the new results if we see this condition (not the page that was previously selected)

@andycochran
Copy link
Collaborator

Refined this a bit. Lemme know if it makes sense to you.

@rylew1
Copy link
Contributor Author

rylew1 commented Mar 20, 2024

@andycochran if ?page=1 already and we hit another filter/query/dropdown - you don't want it to clear the pagination?

rylew1 added a commit that referenced this issue Mar 21, 2024
## Summary
Fixes #1505 

## Changes proposed
- Lift pagination state up to top level in `useSearchFormState`
- Reset the page to 1 when we update the results on inputs other than pagination
- Hide pagination when there's 0 results
@andycochran
Copy link
Collaborator

@andycochran if ?page=1 already and we hit another filter/query/dropdown - you don't want it to clear the pagination?

IDK if that really matters. Aren't ?page=1 and the page param being nonexistent virtually the same thing from a UX perspective? I do like the idea of clearing query params that don't do anything, but not sure if it really matters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
project: grants.gov Grants.gov Modernization tickets
Projects
Development

Successfully merging a pull request may close this issue.

2 participants