From c13059872ebe94876c0800c19c72a53b0c07a9ad Mon Sep 17 00:00:00 2001 From: Josh Story Date: Fri, 5 Apr 2024 13:49:28 -0700 Subject: [PATCH] ReactDOMSharedInternals always has a dispatcher now. It does not need to be existence checked --- .../src/shared/ReactFlightClientConfigDOM.js | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/packages/react-dom-bindings/src/shared/ReactFlightClientConfigDOM.js b/packages/react-dom-bindings/src/shared/ReactFlightClientConfigDOM.js index 61356ce060a53..3cc648270d0d4 100644 --- a/packages/react-dom-bindings/src/shared/ReactFlightClientConfigDOM.js +++ b/packages/react-dom-bindings/src/shared/ReactFlightClientConfigDOM.js @@ -117,13 +117,10 @@ export function preinitModuleForSSR( nonce: ?string, crossOrigin: ?string, ) { - const dispatcher = ReactDOMCurrentDispatcher.current; - if (dispatcher) { - dispatcher.preinitModuleScript(href, { - crossOrigin: getCrossOriginString(crossOrigin), - nonce, - }); - } + ReactDOMCurrentDispatcher.current.preinitModuleScript(href, { + crossOrigin: getCrossOriginString(crossOrigin), + nonce, + }); } export function preinitScriptForSSR( @@ -131,11 +128,8 @@ export function preinitScriptForSSR( nonce: ?string, crossOrigin: ?string, ) { - const dispatcher = ReactDOMCurrentDispatcher.current; - if (dispatcher) { - dispatcher.preinitScript(href, { - crossOrigin: getCrossOriginString(crossOrigin), - nonce, - }); - } + ReactDOMCurrentDispatcher.current.preinitScript(href, { + crossOrigin: getCrossOriginString(crossOrigin), + nonce, + }); }