-
-
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
[data grid] Fix implicit dependency on react-dom #5121
Conversation
@@ -1,5 +1,5 @@ | |||
import * as React from 'react'; | |||
import ReactDOM from 'react-dom'; | |||
import * as ReactDOM from 'react-dom'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bonus refactoring, to match the docs: https://reactjs.org/docs/react-dom.html.
These are the results for the performance tests:
|
It worked, it's more accurate now, only 126.4 kB gzipped 😁 |
@@ -1,5 +1,5 @@ | |||
import * as React from 'react'; | |||
import ReactDOM from 'react-dom'; | |||
import * as ReactDOM from 'react-dom'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@m4theushw When do we plan to use React 18? It would then be
import * as ReactDOM from 'react-dom'; | |
import * as ReactDOM from 'react-dom/client'; |
per https://reactjs.org/blog/2022/03/29/react-v18.html#new-client-and-server-rendering-apis
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm only waiting for the core repo to adopt React 18 in the infra. But nothing stops us from adopting earlier. #4155 is open.
I was on mui/material-ui#33015 (comment), having a quick look at what could explain the jump in bundle size in the data grid at version v5.9.0. We went from 78.1 to 122.1 KB. Compared to react-table 15.7 KB it can be intimidating. I could identify the origin down to #4332, we depend on
react-dom
:mui-x/packages/grid/x-data-grid/src/hooks/features/virtualization/useGridVirtualScroller.tsx
Line 2 in 23aaa6b
but we don't list the dependency.