V2, when data is changed table goes back to page 1
material-react-table version
2.0.0-beta.5
react & react-dom versions
react 18.2.0 dom 18.2.7
Describe the bug and the steps to reproduce it
I have a next.js project which is using Firebase Firestore database with reactfire, with no problem viewing the data, works great.
But if viewing another page, ie moved to page 2 in the table, when a document in the database is updated by another app, react table jumps back to page 1. Even when filtering data, the filter is remembered but always moves back to page 1 when previously was on another page.
Is this working as intended, and I have to handle the issue or is it a bug in the table?
Minimal, Reproducible Example - (Optional, but Recommended)
const tableUser = useMaterialReactTable({ columns, data, columnFilterDisplayMode: 'popover', paginationDisplayMode: 'pages', positionToolbarAlertBanner: 'bottom', })
return ( <p className="w-11/12"> <MaterialReactTable table={tableUser} />
)Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
No, because I do not know how
Terms
- [X] 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.
I've noticed the same in my project using [email protected] and [email protected]. It does not happen when toggling the range-slider filter but every other filter does. Also I noticed it does not happen when I serve the files directly after a npm run storybook:build. I guess this is some kind of dev environment related problem? Does not occur when running the storybook from this repo though... Does it occur in your production build too @ian-sayles ?
Yes @sebaranowski it does happen on production, Firebase Hosting, exactly same as in development.
This usually happens if data ever becomes [] during new fetching, or if rowCount gets set to 0 during refetching.
thanks for reply @KevinVandy, I have been doing some work with this pagination issue, and by luck found out if I just set 'autoResetPageIndex: true' it does not change the pagination when the firestore document is updated, the data in the table is updated but the pagination stays on the same page, not going back to the first page.
In the documentation it states: 'The first one is autoResetPageIndex. This table option is true by default, and causes a table to automatically reset the table back to the first page whenever sorting, filtering, or grouping occurs.'
So how this is working in my app correct way it should work, for I'm not changing any sorting etc just updating the data source?