Skip to content

Mantine-table resets index to zero when controlled Β #376

@enyelsequeira

Description

@enyelsequeira

mantine-react-table version

"mantine-react-table": "^2.0.0-beta.4",

react & react-dom versions

"react-dom": "^18.2.0",

Describe the bug and the steps to reproduce it

I was working on API that needs to have zero index as pagination the BE pagination is something like this
image
meaning there are 4 total of pages, but starts at 0 so in there I would be in page 2 of total pages

what I have found is that if I try to put that in the states, it will not work as intended and the index will be reset to 0
even with this property added autoResetPageIndex: false,
image

possible issue could be the pagination component from mantine does not start at 0? https://mantine.dev/core/pagination/#controlled

while this is hard to debug, I created repo where it works fine, but if you work with and API that index start at 0 will always reset.
I did made it work by creating a custom pagination, where it is outside the table scope controlling, this is the main reason it makes me belives that the issue could deal with how the pagination component from mantine behaves
image

Minimal, Reproducible Example - (Optional, but Recommended)

https://stackblitz.com/edit/github-ex4yja?file=src%2FTS.tsx

Screenshots or Videos (Optional)

No response

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

Yes, I think I know how to fix it and will discuss it in the comments of this issue

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    V2Issue with MRT V2bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions