From e733f74e6f71faeab7d2446932a87bbee975fcb9 Mon Sep 17 00:00:00 2001 From: Ricky Date: Thu, 1 Feb 2024 18:32:04 -0500 Subject: [PATCH] Add ReactDOMClient to ServerIntegrationBasic (#28133) ## Overview Branched off https://github.com/facebook/react/pull/28130 In `hydrateRoot`, we now error if you pass `undefined`: ``` Warning: Must provide initial children as second argument to hydrateRoot. ``` So we expect 1 error for this now. --- .../__tests__/ReactDOMServerIntegrationBasic-test.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationBasic-test.js b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationBasic-test.js index a0793a6215b66..2821dd088bb48 100644 --- a/packages/react-dom/src/__tests__/ReactDOMServerIntegrationBasic-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMServerIntegrationBasic-test.js @@ -15,7 +15,7 @@ const ReactDOMServerIntegrationUtils = require('./utils/ReactDOMServerIntegratio const TEXT_NODE_TYPE = 3; let React; -let ReactDOM; +let ReactDOMClient; let ReactDOMServer; let ReactTestUtils; @@ -23,13 +23,13 @@ function initModules() { // Reset warning cache. jest.resetModules(); React = require('react'); - ReactDOM = require('react-dom'); + ReactDOMClient = require('react-dom/client'); ReactDOMServer = require('react-dom/server'); ReactTestUtils = require('react-dom/test-utils'); // Make them available to the helpers. return { - ReactDOM, + ReactDOMClient, ReactDOMServer, ReactTestUtils, }; @@ -149,8 +149,10 @@ describe('ReactDOMServerIntegration', () => { expect(await render([])).toBe(null); expect(await render(false)).toBe(null); expect(await render(true)).toBe(null); - expect(await render(undefined)).toBe(null); expect(await render([[[false]], undefined])).toBe(null); + + // hydrateRoot errors for undefined children. + expect(await render(undefined, 1)).toBe(null); }); }); });