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

fix(pagination): out of boundaries page Grid Preset should be unset #1534

Merged
merged 2 commits into from
May 18, 2024

Conversation

ghiscoding
Copy link
Owner

@ghiscoding ghiscoding commented May 17, 2024

  • in the OData example, we have a Grid Preset of page number 2 and that demo also uses local storage, if we keep the Gender filter and also add a Name filter like "G", it results to a total of 9 items and it works fine unless we refresh the page. After a page refresh, and when our page size is set to 20, we are now out of bound and the 9 items weren't showing up because the system thought it was on page 2 even though we shouldn't... So let's make sure to never be out of boundaries and reset to first page when that happens (or page 0 when no items found)
  • a side note, I imagine that the issue described above and shown below would probably never happened with a real server since the OData server would never return a page number that is outside of boundaries, which is probably why nobody ever reported the issue
  • also add a prop observer on the gridOptions.pagination.totalItems since the user could change it but forgets to call refreshPagination()

brave_8q5FQvOIsO

- in the OData example, we have a Grid Preset of page number 2 and that demo also uses local storage, if we keep the Gender filter and also add a Name filter like "G", it results to a total of 9 items and when our page size is set to 20, we are now out of bound and the 9 items weren't showing up because the system thought it was on page 2... So let's make sure to reset to first page when out of boundaries (or page 0 when no items found)
- also add an prop observer on the `gridOptions.pagination.totalItems` since the user could change it but forgets to call `refreshPagination()`
Copy link

stackblitz bot commented May 17, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

codecov bot commented May 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.8%. Comparing base (51560aa) to head (59cb3cf).

Additional details and impacted files
@@           Coverage Diff            @@
##           master   #1534     +/-   ##
========================================
+ Coverage    99.8%   99.8%   +0.1%     
========================================
  Files         198     198             
  Lines       21633   21636      +3     
  Branches     7227    7089    -138     
========================================
+ Hits        21572   21575      +3     
  Misses         55      55             
  Partials        6       6             

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ghiscoding ghiscoding merged commit b800da3 into master May 18, 2024
7 checks passed
@ghiscoding ghiscoding deleted the bugfix/invalid-pagination-preset branch May 18, 2024 00:14
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.

None yet

1 participant