KevinVandy/material-react-table

pageCount:-1 does not seem to work as intended

kaayru opened this issue · 0 comments

material-react-table version

2.13.0

react & react-dom versions

18

Describe the bug and the steps to reproduce it

I'm trying to setup a table with data coming from a paginated API, that only returns current page's data and a token to fetch the next page.

According to React Table documentation:

When manually controlling pagination, you can supply a total pageCount value to the table if you know it. If you do not know how many pages there are, you can set this to -1. Alternatively, you can provide a rowCount value and the table will calculate the pageCount internally.

I'm trying to set pageCount to -1 but it does seem not work as intented.

The Next arrow in the pagination stays disabled. I digged a little bit in the repo, I found this. Next page button is only controlled by whether or not lastRowIndex >= totalRowCount, but it should also be controlled by whether or not pageCount equals -1, no?

const disableNext = lastRowIndex >= totalRowCount || disabled;

Am I not understanding something?

Minimal, Reproducible Example - (Optional, but Recommended)

Screenshots or Videos (Optional)

No response

Do you intend to try to help solve this bug with your own PR?

None

Terms

  • I understand that if my bug cannot be reliably reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.