From 33b824a51952b59176c97c617fa1d1268f8435dd Mon Sep 17 00:00:00 2001 From: Josh Story Date: Thu, 7 Sep 2023 14:48:22 -0700 Subject: [PATCH] [Float][Fizz] include `preloadModule` and `preinitModule` on `react-dom/server-rendering-stub` (#27347) When implementing `preloadModule` and `preinitModule` these methods were not exposed on the server rendering stub when they should have been. This PR corrects that omission. --- packages/react-dom/server-rendering-stub.js | 2 ++ .../src/__tests__/react-dom-server-rendering-stub-test.js | 6 ++++-- .../react-dom/src/server/ReactDOMServerRenderingStub.js | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/react-dom/server-rendering-stub.js b/packages/react-dom/server-rendering-stub.js index 41861fbfc9ea9..ef9f14d78230e 100644 --- a/packages/react-dom/server-rendering-stub.js +++ b/packages/react-dom/server-rendering-stub.js @@ -21,7 +21,9 @@ export { prefetchDNS, preconnect, preload, + preloadModule, preinit, + preinitModule, experimental_useFormStatus, experimental_useFormState, unstable_batchedUpdates, diff --git a/packages/react-dom/src/__tests__/react-dom-server-rendering-stub-test.js b/packages/react-dom/src/__tests__/react-dom-server-rendering-stub-test.js index 4a805d7edb1bc..ea4039a4510bb 100644 --- a/packages/react-dom/src/__tests__/react-dom-server-rendering-stub-test.js +++ b/packages/react-dom/src/__tests__/react-dom-server-rendering-stub-test.js @@ -39,15 +39,17 @@ describe('react-dom-server-rendering-stub', () => { }); // @gate enableFloat - it('provides preload and preinit exports', async () => { + it('provides preload, preloadModule, preinit, and preinitModule exports', async () => { function App() { ReactDOM.preload('foo', {as: 'style'}); + ReactDOM.preloadModule('foomodule'); ReactDOM.preinit('bar', {as: 'style'}); + ReactDOM.preinitModule('barmodule'); return
foo
; } const html = ReactDOMFizzServer.renderToString(); expect(html).toEqual( - '
foo
', + '
foo
', ); }); diff --git a/packages/react-dom/src/server/ReactDOMServerRenderingStub.js b/packages/react-dom/src/server/ReactDOMServerRenderingStub.js index 537f8c5618c39..8adc9ade4aeb3 100644 --- a/packages/react-dom/src/server/ReactDOMServerRenderingStub.js +++ b/packages/react-dom/src/server/ReactDOMServerRenderingStub.js @@ -9,7 +9,9 @@ export { preinit, + preinitModule, preload, + preloadModule, preconnect, prefetchDNS, } from '../shared/ReactDOMFloat';