Skip to content

Commit

Permalink
[DOM] Shrink ReactDOMCurrentDispatcher method names (#28770)
Browse files Browse the repository at this point in the history
Stacked on #28771

ReactDOMCurrentDispatcher has longer property names for various methods.
These methods are only ever called internally and don't need to be
represented with as many characters. This change shortens the names and
aligns them with the hint codes we use in Flight. This alignment is
passive since not all dispatcher methods will exist as flight
instructions but where they can line up it seems reasonable to make them
do so

DiffTrain build for [97c90ed](97c90ed)
  • Loading branch information
gnoff committed Apr 8, 2024
1 parent 9ea88c8 commit 7739cd4
Show file tree
Hide file tree
Showing 21 changed files with 1,385 additions and 731 deletions.
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9007fdc8f103a5d9247be384791496db9a3be91d
97c90ed8835401e325e42de22f38a803c5e6fc6d
262 changes: 179 additions & 83 deletions compiled/facebook-www/ReactDOM-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -3024,14 +3024,30 @@ if (__DEV__) {
function noop$3() {}

var DefaultDispatcher = {
flushSyncWork: noop$3,
prefetchDNS: noop$3,
preconnect: noop$3,
preload: noop$3,
preloadModule: noop$3,
preinitScript: noop$3,
preinitStyle: noop$3,
preinitModuleScript: noop$3
f:
/* flushSyncWork */
noop$3,
D:
/* prefetchDNS */
noop$3,
C:
/* preconnect */
noop$3,
L:
/* preload */
noop$3,
m:
/* preloadModule */
noop$3,
X:
/* preinitScript */
noop$3,
S:
/* preinitStyle */
noop$3,
M:
/* preinitModuleScript */
noop$3
};
var Internals = {
Events: null,
Expand Down Expand Up @@ -36162,7 +36178,7 @@ if (__DEV__) {
return root;
}

var ReactVersion = "19.0.0-www-classic-393dd949";
var ReactVersion = "19.0.0-www-classic-42767cb4";

function createPortal$1(
children,
Expand Down Expand Up @@ -45606,14 +45622,31 @@ if (__DEV__) {
Internals.d =
/* ReactDOMCurrentDispatcher */
{
flushSyncWork: previousDispatcher.flushSyncWork,
prefetchDNS: prefetchDNS$1,
preconnect: preconnect$1,
preload: preload$1,
preloadModule: preloadModule$1,
preinitStyle: preinitStyle,
preinitScript: preinitScript,
preinitModuleScript: preinitModuleScript
f:
/* flushSyncWork */
previousDispatcher.f,
/* flushSyncWork */
D:
/* prefetchDNS */
prefetchDNS$1,
C:
/* preconnect */
preconnect$1,
L:
/* preload */
preload$1,
m:
/* preloadModule */
preloadModule$1,
X:
/* preinitScript */
preinitScript,
S:
/* preinitStyle */
preinitStyle,
M:
/* preinitModuleScript */
preinitModuleScript
};
// how we resolve the HoistableRoot for ReactDOM.pre*() methods. Because we support calling
// these methods outside of render there is no way to know which Document or ShadowRoot is 'scoped'
Expand Down Expand Up @@ -45658,17 +45691,29 @@ if (__DEV__) {
}

function prefetchDNS$1(href) {
previousDispatcher.prefetchDNS(href);
previousDispatcher.D(
/* prefetchDNS */
href
);
preconnectAs("dns-prefetch", href, null);
}

function preconnect$1(href, crossOrigin) {
previousDispatcher.preconnect(href, crossOrigin);
previousDispatcher.C(
/* preconnect */
href,
crossOrigin
);
preconnectAs("preconnect", href, crossOrigin);
}

function preload$1(href, as, options) {
previousDispatcher.preload(href, as, options);
previousDispatcher.L(
/* preload */
href,
as,
options
);
var ownerDocument = getGlobalDocument();

if (ownerDocument && href && as) {
Expand Down Expand Up @@ -45765,7 +45810,11 @@ if (__DEV__) {
}

function preloadModule$1(href, options) {
previousDispatcher.preloadModule(href, options);
previousDispatcher.m(
/* preloadModule */
href,
options
);
var ownerDocument = getGlobalDocument();

if (ownerDocument && href) {
Expand Down Expand Up @@ -45831,7 +45880,12 @@ if (__DEV__) {
}

function preinitStyle(href, precedence, options) {
previousDispatcher.preinitStyle(href, precedence, options);
previousDispatcher.S(
/* preinitStyle */
href,
precedence,
options
);
var ownerDocument = getGlobalDocument();

if (ownerDocument && href) {
Expand Down Expand Up @@ -45904,7 +45958,11 @@ if (__DEV__) {
}

function preinitScript(src, options) {
previousDispatcher.preinitScript(src, options);
previousDispatcher.X(
/* preinitScript */
src,
options
);
var ownerDocument = getGlobalDocument();

if (ownerDocument && src) {
Expand Down Expand Up @@ -45957,7 +46015,11 @@ if (__DEV__) {
}

function preinitModuleScript(src, options) {
previousDispatcher.preinitModuleScript(src, options);
previousDispatcher.M(
/* preinitModuleScript */
src,
options
);
var ownerDocument = getGlobalDocument();

if (ownerDocument && src) {
Expand Down Expand Up @@ -48710,7 +48772,10 @@ if (__DEV__) {
if (typeof href === "string") {
Internals.d
/* ReactDOMCurrentDispatcher */
.prefetchDNS(href);
.D(
/* prefetchDNS */
href
);
} // We don't error because preconnect needs to be resilient to being called in a variety of scopes
// and the runtime may not be capable of responding. The function is optimistic and not critical
// so we favor silent bailout over warning or erroring.
Expand Down Expand Up @@ -48741,7 +48806,11 @@ if (__DEV__) {
: null;
Internals.d
/* ReactDOMCurrentDispatcher */
.preconnect(href, crossOrigin);
.C(
/* preconnect */
href,
crossOrigin
);
} // We don't error because preconnect needs to be resilient to being called in a variety of scopes
// and the runtime may not be capable of responding. The function is optimistic and not critical
// so we favor silent bailout over warning or erroring.
Expand Down Expand Up @@ -48787,33 +48856,39 @@ if (__DEV__) {
var crossOrigin = getCrossOriginStringAs(as, options.crossOrigin);
Internals.d
/* ReactDOMCurrentDispatcher */
.preload(href, as, {
crossOrigin: crossOrigin,
integrity:
typeof options.integrity === "string"
? options.integrity
: undefined,
nonce:
typeof options.nonce === "string" ? options.nonce : undefined,
type: typeof options.type === "string" ? options.type : undefined,
fetchPriority:
typeof options.fetchPriority === "string"
? options.fetchPriority
: undefined,
referrerPolicy:
typeof options.referrerPolicy === "string"
? options.referrerPolicy
: undefined,
imageSrcSet:
typeof options.imageSrcSet === "string"
? options.imageSrcSet
: undefined,
imageSizes:
typeof options.imageSizes === "string"
? options.imageSizes
: undefined,
media: typeof options.media === "string" ? options.media : undefined
});
.L(
/* preload */
href,
as,
{
crossOrigin: crossOrigin,
integrity:
typeof options.integrity === "string"
? options.integrity
: undefined,
nonce:
typeof options.nonce === "string" ? options.nonce : undefined,
type: typeof options.type === "string" ? options.type : undefined,
fetchPriority:
typeof options.fetchPriority === "string"
? options.fetchPriority
: undefined,
referrerPolicy:
typeof options.referrerPolicy === "string"
? options.referrerPolicy
: undefined,
imageSrcSet:
typeof options.imageSrcSet === "string"
? options.imageSrcSet
: undefined,
imageSizes:
typeof options.imageSizes === "string"
? options.imageSizes
: undefined,
media:
typeof options.media === "string" ? options.media : undefined
}
);
} // We don't error because preload needs to be resilient to being called in a variety of scopes
// and the runtime may not be capable of responding. The function is optimistic and not critical
// so we favor silent bailout over warning or erroring.
Expand Down Expand Up @@ -48861,21 +48936,28 @@ if (__DEV__) {
);
Internals.d
/* ReactDOMCurrentDispatcher */
.preloadModule(href, {
as:
typeof options.as === "string" && options.as !== "script"
? options.as
: undefined,
crossOrigin: crossOrigin,
integrity:
typeof options.integrity === "string"
? options.integrity
: undefined
});
.m(
/* preloadModule */
href,
{
as:
typeof options.as === "string" && options.as !== "script"
? options.as
: undefined,
crossOrigin: crossOrigin,
integrity:
typeof options.integrity === "string"
? options.integrity
: undefined
}
);
} else {
Internals.d
/* ReactDOMCurrentDispatcher */
.preloadModule(href);
.m(
/* preloadModule */
href
);
}
} // We don't error because preload needs to be resilient to being called in a variety of scopes
// and the runtime may not be capable of responding. The function is optimistic and not critical
Expand Down Expand Up @@ -48918,7 +49000,8 @@ if (__DEV__) {
if (as === "style") {
Internals.d
/* ReactDOMCurrentDispatcher */
.preinitStyle(
.S(
/* preinitStyle */
href,
typeof options.precedence === "string"
? options.precedence
Expand All @@ -48932,13 +49015,17 @@ if (__DEV__) {
} else if (as === "script") {
Internals.d
/* ReactDOMCurrentDispatcher */
.preinitScript(href, {
crossOrigin: crossOrigin,
integrity: integrity,
fetchPriority: fetchPriority,
nonce:
typeof options.nonce === "string" ? options.nonce : undefined
});
.X(
/* preinitScript */
href,
{
crossOrigin: crossOrigin,
integrity: integrity,
fetchPriority: fetchPriority,
nonce:
typeof options.nonce === "string" ? options.nonce : undefined
}
);
}
} // We don't error because preinit needs to be resilient to being called in a variety of scopes
// and the runtime may not be capable of responding. The function is optimistic and not critical
Expand Down Expand Up @@ -49007,20 +49094,29 @@ if (__DEV__) {
);
Internals.d
/* ReactDOMCurrentDispatcher */
.preinitModuleScript(href, {
crossOrigin: crossOrigin,
integrity:
typeof options.integrity === "string"
? options.integrity
: undefined,
nonce:
typeof options.nonce === "string" ? options.nonce : undefined
});
.M(
/* preinitModuleScript */
href,
{
crossOrigin: crossOrigin,
integrity:
typeof options.integrity === "string"
? options.integrity
: undefined,
nonce:
typeof options.nonce === "string"
? options.nonce
: undefined
}
);
}
} else if (options == null) {
Internals.d
/* ReactDOMCurrentDispatcher */
.preinitModuleScript(href);
.M(
/* preinitModuleScript */
href
);
}
} // We don't error because preinit needs to be resilient to being called in a variety of scopes
// and the runtime may not be capable of responding. The function is optimistic and not critical
Expand Down
Loading

0 comments on commit 7739cd4

Please sign in to comment.