Skip to content

Commit

Permalink
ReactDOMSharedInternals always has a dispatcher now. It does not need…
Browse files Browse the repository at this point in the history
… to be existence checked
  • Loading branch information
gnoff committed Apr 8, 2024
1 parent 4c12339 commit 7d422a0
Showing 1 changed file with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,25 +117,19 @@ 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(
href: string,
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,
});
}

0 comments on commit 7d422a0

Please sign in to comment.