[v7-alpha.21] Pagination does not work with grouping
See original GitHub issueFirst of all, thank you so much for your work - it is awesome!
Bug description
I noticed a bug when trying to use useGroupBy
, useExpanded
and usePagination
hooks: as soon as the grouping is activated (either manually by the user, or programmatically, using default table state), the component runs into an infinite re-rendering cycle. Meaning that it starts re-rendering every several milliseconds without any reason. Also, pagination stops working.
To reproduce To reproduce it, I slightly modified your original example of grouping:
- Go to https://codesandbox.io/s/tannerlinsleyreact-table-grouping-zrmbi
- Open the console: you’ll see there’s only one “rendering…” message logged from the component, which is as expected
- Now click on any column to group by it
- You’ll notice infinitely many “rendering…” messages appearing in the console
- Try clicking on “next page” button: pagination doesn’t work
- If you disable grouping of that column, everything works fine again
- If you remove
usePagination
hook and adjust the component to userows
instance property instead ofpage
, grouping works fine without infinite re-rendering
Expected behavior Obviously, no infinite rendering and working pagination.
Additional context
I also noticed that nestExpandedRows
table option doesn’t have any effect. Either it is true
or false
, when you expand the last row in the grouped table, nested values are paginated and thus are not displayed. Maybe it’s a separate bug, or maybe it’s related.
I could live with this issue by simply disabling pagination when using grouping. But in my own code, I use a common Table
component where I need to provide both functionalities for the outer components. And it seems there is no way to disable pagination with table options, is there? As a side note, it would be nice to have such an option
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (1 by maintainers)
This should be fixed. See https://github.com/tannerlinsley/react-table/tree/master/examples/kitchen-sink for an example.
It’ll be fixed soon. Hang tight.