fix: pagination adjusts correctly after table deletes #397
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
The pagination in the demo site had a bug where deleting rows from a table would leave users on invalid or empty pages. This created a poor user experience where users could be stuck on empty pages after deleting items.
Solution
This PR fixes the pagination logic in the
delete_message()function for both Bootstrap 4 and Bootstrap 5 demo applications:Testing
Files Changed
examples/bootstrap4/app.py- Fixed pagination logic in delete_message()examples/bootstrap5/app.py- Fixed pagination logic in delete_message()tests/test_bootstrap4/test_render_pagination.py- Added pagination teststests/test_bootstrap5/test_pagination.py- Added pagination testsRelated Issue
Fixes the "Pagination in demo site depends on table deletes" issue where pagination would break after deleting table rows.
Result
Users now have a smooth experience when deleting items from paginated tables, with intelligent redirects that always land them on valid pages with content.