-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
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
[mui-utils][test] Remove usages of deprecated react-dom APIs #42780
base: next
Are you sure you want to change the base?
[mui-utils][test] Remove usages of deprecated react-dom APIs #42780
Conversation
Netlify deploy previewhttps://deploy-preview-42780--material-ui.netlify.app/ Bundle size report |
0312f13
to
c16bd9f
Compare
c16bd9f
to
21d1ff5
Compare
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.
Getting closer and closer to React 18.3 🎉
let rootNode: HTMLElement; | ||
|
||
function assertPass(element: any, { shouldMount = true } = {}) { | ||
async function assertPass(element: any, { shouldMount = true } = {}) { |
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.
What is asynchronous? 🤔
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.
await waitFor
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 see, I got confused thinking await waitFor
was outside of assertPass
😅
waitFor
is suggested for lazy components, is React.Suspense
using lazy initialization? I'm not very familiar with its implementation 🤔
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.
My understanding is that React.Suspense
+ waitFor
are only required because of the "accepts lazy"
test, which renders a React.lazy
component. Kinda weird we use this approach when only a single test requires it, but then the assertPass
abstraction falls apart.
Maybe we can simplify assertPass
and just not use it for "accepts lazy"
. I tried to leave unnecessary changes out of this PR but it's kinda difficult with the assertPass
abstraction.
In preparation for #42047, we need to remove
react-dom
deprecated APIs, namely,render
andunmountComponentAtNode
. This PR replaces these APIs withcreateRenderer
, our React Testing Library wrapper.