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: handle pagination issue when search results do not match current… #830

Closed
wants to merge 2 commits into from

Conversation

vv-m
Copy link

@vv-m vv-m commented Oct 11, 2024

Description

This PR fixes a pagination issue in SQLAdmin where performing a search from a page other than the first page would result in an error (“Invalid page or pageSize parameter”) if the search results had fewer pages than the current page.

Changes

  • Added logic to check the total number of pages after performing a search.
  • If the current page exceeds the total available pages in the search results, the user is automatically redirected to the first page.
  • This ensures smooth user experience when navigating between search results and pagination.

Testing

  • Verified that search works correctly when on different pages of the pagination.
  • Verified that the user is correctly redirected to the first page if the current page number exceeds the available pages in the search results.

vv-m added 2 commits October 11, 2024 13:36
… page

Corrected behavior to automatically redirect users to the first page if the current search result has fewer pages than the page they were on. This prevents an error where a search performed from a non-existent page number would cause incorrect behavior (“Invalid page or pageSize parameter”)
… page

Corrected behavior to automatically redirect users to the first page if the current search result has fewer pages than the page they were on. This prevents an error where a search performed from a non-existent page number would cause incorrect behavior (“Invalid page or pageSize parameter”)
Copy link
Owner

@aminalaee aminalaee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a basic unit test to cover this?

@alex-lambdaloopers
Copy link
Contributor

Hi, I believe this is a duplicate of #814. The approach is different in that this change redirects you to the first page, whereas 814 redirects to the maximum allowed page.

@aminalaee
Copy link
Owner

Yeah I think you are right. This can be closed then.

@aminalaee aminalaee closed this Oct 15, 2024
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.

3 participants