-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uncaught TypeError: Cannot set properties of null (setting 'scrollTop') #14987
Uncaught TypeError: Cannot set properties of null (setting 'scrollTop') #14987
Comments
Thank you @theodoremoreland for the reproduction and detailed reproduction steps. When the Data Grid is rendered in a I tried to fix it in #15009 and a codesandbox generated from it seems to not have the problem anymore: https://codesandbox.io/p/sandbox/snowy-river-2skv9t @mui/xgrid Yet another culprit of |
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Note @theodoremoreland How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey. |
I am seeing a related error which is For more context, the error happens in my app after scrolling the data grid and then navigating quickly after so that the component unmounts/is destroyed. Tested this in the latest version of |
@giavinh79 I tried reproducing this issue, but no luck: https://codesandbox.io/p/sandbox/affectionate-brook-qprvq4 |
Link to live example: https://theodoremoreland.github.io/mui-x-data-grid-bug-demo/
The code can be found here: https://github.com/theodoremoreland/mui-x-data-grid-bug-demo/tree/updated-package-versions
This bug was actually discovered and reported by another person prior, but the thread was closed temporarily: #13301
The bug
When scrolling to the very bottom of the virtual scrollbar using a scroll wheel then decreasing the number of rows in a Data Grid via clicking a lesser page option or via programmatically deleting rows via some custom UI prompt (such as a Delete button) such that the vertical, virtual scroll bar is no longer needed, the Data Grid will throw the following error on
Chrome
:The following error on
Firefox
:OR
NOTE: Reproducing the error via programmatic deletion is inconsistent on Firefox (in my experience). However, the error occurs consistently in Chrome and in both browsers via decreasing page option.
Steps to reproduce
The conditions to reproduce the bug are very conditional, if not inconsistent. For example, from what I can tell:
Use case 1
NOTE: Oddly enough, scrolling to the bottom of the grid / virtual scrollbar
by clicking and dragging the scroll bar down does not produce an error nor does scrolling close to the bottom. The error is only produced by scrolling to the absolute bottom of the scrollbar via scroll wheel in this example.
If running the code locally, you should see an error popup in the UI. If running a deployed build, you may only see the error in the dev console.
Screenshots 1
Use case 2
NOTE: Weirdly enough, the following steps produce an error far more often
when using Google Chrome, in my experience. It may take multiple attempts
to get the error to produce in Firefox if at all.
If running the code locally, you should see an error popup in the UI. If running a deployed build, you may only see the error in the dev console.
Screenshots 2
A potential workaround
For some reason, how you render React's root DOM node can circumvent the error. For example, given "react": "^18.3.1" and "react-dom": "^18.3.1":
This does not work:
This does:
Current behavior
An error appears in the UI and in the dev console.
Expected behavior
Same functionality but without error message.
Context
I am trying to scroll to the bottom of the grid then proceed to decrease the number of rows displayed either via programmatic deletion or decreasing page options.
Your environment
npx @mui/envinfo
I have test Chrome and Firefox.
Search keywords: GridVirtualScrollbar data grid null scrolltop scroll
The text was updated successfully, but these errors were encountered: