Closed duckboy81 closed 1 year ago
Nice investigation, was going to say that it sounds like a duplicate of #259 , but yeah, this still seems to be an issue. The toolbar ref being a culprit would be really weird, but possible I guess. I thought it was an issue with @tanstack/react-virutal
itself, but probably has to do with the table deleting itself when going fullscreen. That logic is in the MRT_TableRoot component.
It's interesting for sure. I'm chasing a lead in the following code. It seems if I set bottomToolbarHeight
to something small (0
or even 1
) it had no issues.
The only consumer of totalToolbarHeight
is the TableContainer
component. So I'm starting to look into this as well.
We'll see what I come up with.
@duckboy81 Welp, you have found the ugliest code in the MRT codebase probably lol. I actually wish to delete it, but I think it was the only way to do... something... I think get rid of a scrollbar in fullscreen mode?
@KevinVandy Alright, pull request submitted. If that comes through clean on your end, I wonder if we should also update MRT_TopToolbar
and/or MRT_TablePaper
to match.
@KevinVandy Alright, pull request submitted. If that comes through clean on your end, I wonder if we should also update
MRT_TopToolbar
and/orMRT_TablePaper
to match.
Adding the if
checks? probably
material-react-table version
v1.5.6
react & react-dom versions
v5.11.4 & v18.0.10
Describe the bug and the steps to reproduce it
Troubleshooting this right now. It appears the bad combo is
enableRowVirtualization
andenableBottomToolbar
. Disabling either one of these will prevent the issue.Digging into it,
MRT_BottomToolbar
seems to be the culprit. If you pass your ownrenderBottomToolbar
,MRT_BottomToolbar
is not used and there is no issue.Removing the following
ref
prop from theToolbar
component inMRT_BottomToolbar
seems to prevent the issue, but I'm doing some more research now.https://github.com/KevinVandy/material-react-table/blob/aa72893599d091fd0a77f7d1732219f36e13e33d/packages/material-react-table/src/toolbar/MRT_BottomToolbar.tsx#L45-L51
Interestingly, manually attaching my own
MutationObserver
to the "table body section" (I've since forgot what it's actually called) would show that the "table body section" is removed from DOM and the observer loses any new updates when the bug is occurring. When things work normally, theMutationObserver
is unaffected and new updates are passed correctly.The final update the
MutationObserver
sees when exiting fullscreen is a0px
"table body section" height so all rows are removed except for the number of rows specified in theoverscan
setting.259
Minimal, Reproducible Example - (Optional, but Recommended)
https://codesandbox.io/s/gracious-jepsen-ndef3b?file=/src/TS.tsx
Screenshots or Videos (Optional)
No response
Do you intend to try to help solve this bug with your own PR?
Maybe, I'll investigate and start debugging
Terms