dosubot[bot] commented on issue #31403:
URL: https://github.com/apache/superset/issues/31403#issuecomment-2536223260
<!-- Greeting -->
Hello, @Splinterfeel! I'm here to help you with any bugs, questions, or
contributions you have. Let's tackle this issue together!
<!-- Answer -->
The error you're encountering, "getPaginationModel(): currentPage shouldn't
be greater than totalPages," typically occurs when the pagination state is not
updated correctly after a search query that returns fewer results than the
current page. In Superset, when the dataset changes, such as when a search
query is performed, the pagination state should be recalculated to ensure the
current page is within valid bounds.
The Superset codebase handles this by checking if the current page index is
greater than the total number of pages minus one. If this condition is true and
there are pages available, it resets the page index to zero. This is done using
the following logic:
```tsx
useEffect(() => {
if (!loading && pageIndex > pageCount - 1 && pageCount > 0) {
gotoPage(0);
}
}, [gotoPage, loading, pageCount, pageIndex]);
```
This ensures that if a search query returns fewer results than the current
page, the pagination state is updated to show the first page of the new result
set
<sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/src/components/ListView/ListView.tsx)</sup>.
To resolve the issue, you may need to ensure that this logic is correctly
implemented in the components handling pagination and search functionality,
such as `index.tsx`, `Input.js`, and `singleQueryResultPane.tsx`.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
---
<sup>Help Dosu learn! Give it feedback: [Great
Response](https://app.dosu.dev/response-feedback/d4f5c4f2-f406-4891-8314-605d5aa225ff?feedback_type=great_response)
| [Irrelevant
Answer](https://app.dosu.dev/response-feedback/d4f5c4f2-f406-4891-8314-605d5aa225ff?feedback_type=irrelevant_answer)
| [Incorrect
Sources](https://app.dosu.dev/response-feedback/d4f5c4f2-f406-4891-8314-605d5aa225ff?feedback_type=incorrect_sources)
| [Too
Verbose](https://app.dosu.dev/response-feedback/d4f5c4f2-f406-4891-8314-605d5aa225ff?feedback_type=too_verbose)
|
[Hallucination](https://app.dosu.dev/response-feedback/d4f5c4f2-f406-4891-8314-605d5aa225ff?feedback_type=hallucination)
|
[Other](https://app.dosu.dev/response-feedback/d4f5c4f2-f406-4891-8314-605d5aa225ff?feedback_type=other)</sup>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]