-
Notifications
You must be signed in to change notification settings - Fork 47.2k
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
Update ReactDOMServerSuspense-test to not use legacy rendering APIs #28251
Conversation
Comparing: 952aa74...be76c13 Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: Expand to show
|
@@ -41,7 +41,7 @@ function initModules() { | |||
}; | |||
} | |||
|
|||
const {itThrowsWhenRendering, resetModules, serverRender} = | |||
const {resetModules, itThrowsWhenRendering} = |
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.
@gnoff line 38 is still using ReactDOM
instead of ReactDOMClient
so the itThrowsWhenRendering
tests are still using the legacy renderer.
If you pass ReactDOMClient
here:
return {
ReactDOMClient,
ReactDOMServer,
ReactTestUtils,
};
Then we switch to hyrdateRoot
in the helpers:
react/packages/react-dom/src/__tests__/utils/ReactDOMServerIntegrationTestUtils.js
Lines 55 to 63 in 6054be9
if (ReactDOMClient) { | |
ReactDOMClient.hydrateRoot(domElement, reactElement, { | |
onRecoverableError: () => { | |
// TODO: assert on recoverable error count. | |
}, | |
}); | |
} else { | |
ReactDOM.hydrate(reactElement, domElement); | |
} |
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.
Ah I didn't realize the I had to return the client version for the utils to use it. I took another look and the thing the itThrowsWhenRendering
was asserting actually is wrong now for concurrent roots on the client so really the test only should be asserting on server behavior (also probably what the test was written for originally given the filename). I just ripped out the test utils entirely now and it only uses the underlying modules directly.
Thanks for flagging!
f9e7047
to
f946f51
Compare
Updates ReactDOMServerSuspense-test to not use legacy rendering APIs. Previously this test was relying on suspending in the legacy renderer to throw during server rendering as well as during client rendering. With the advent of concurrent roots on the client however this doesn't make sense and it only makes sense on the server when using legacy apis like renderToString. I have removed the use of ReactDOMServerIntegrationTestUtils in this test suite and limited the tests to server tests using renderToString to keep as much parity with what was being tested before while dropping anything that no longer makes sense to assert on concurrent client roots
itThrowsWhenRendering( | ||
'a suspending component without a Suspense above', | ||
async render => { | ||
await render( | ||
<div> | ||
<AsyncText text="Children" /> | ||
</div>, | ||
1, | ||
); | ||
}, | ||
'A component suspended while responding to synchronous input.', | ||
); | ||
} |
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.
this is essentially a duplicate of the above test
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 feel like it's worth keeping in case there's something fucky with having a boundary in the tree
Updates React from 2bc7d336a to ba5e6a832. ### React upstream changes - facebook/react#28283 - facebook/react#28280 - facebook/react#28079 - facebook/react#28233 - facebook/react#28276 - facebook/react#28272 - facebook/react#28265 - facebook/react#28259 - facebook/react#28153 - facebook/react#28246 - facebook/react#28218 - facebook/react#28263 - facebook/react#28257 - facebook/react#28261 - facebook/react#28262 - facebook/react#28260 - facebook/react#28258 - facebook/react#27864 - facebook/react#28254 - facebook/react#28219 - facebook/react#28248 - facebook/react#28216 - facebook/react#28249 - facebook/react#28241 - facebook/react#28243 - facebook/react#28253 - facebook/react#28256 - facebook/react#28236 - facebook/react#28237 - facebook/react#28242 - facebook/react#28251 - facebook/react#28252 Closes NEXT-2411
…acebook#28251) Updates ReactDOMServerSuspense-test to not use legacy rendering APIs Also removes an experimental only gate that is not necessary
Updates ReactDOMServerSuspense-test to not use legacy rendering APIs
Also removes an experimental only gate that is not necessary