Skip to content

Commit 7829e07

Browse files
committed
Use a shared noop function from shared/noop (facebook#33154)
Stacked on facebook#33150. We use `noop` functions in a lot of places as place holders. I don't think there's any real optimizations we get from having separate instances. This moves them to use a common instance in `shared/noop`. DiffTrain build for [21fdf30](facebook@21fdf30)
1 parent f681712 commit 7829e07

36 files changed

+2326
-2551
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ac06829246287751e6b74bd99cd1b39d1aeba06a
1+
21fdf308a1a01af69c28c00a70086aa1bd4c2411
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
ac06829246287751e6b74bd99cd1b39d1aeba06a
1+
21fdf308a1a01af69c28c00a70086aa1bd4c2411

compiled/facebook-www/React-dev.classic.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ __DEV__ &&
5959
this.refs = emptyObject;
6060
this.updater = updater || ReactNoopUpdateQueue;
6161
}
62+
function noop() {}
6263
function testStringCoercion(value) {
6364
return "" + value;
6465
}
@@ -383,7 +384,6 @@ __DEV__ &&
383384
? (checkKeyStringCoercion(element.key), escape("" + element.key))
384385
: index.toString(36);
385386
}
386-
function noop$1() {}
387387
function resolveThenable(thenable) {
388388
switch (thenable.status) {
389389
case "fulfilled":
@@ -393,7 +393,7 @@ __DEV__ &&
393393
default:
394394
switch (
395395
("string" === typeof thenable.status
396-
? thenable.then(noop$1, noop$1)
396+
? thenable.then(noop, noop)
397397
: ((thenable.status = "pending"),
398398
thenable.then(
399399
function (fulfilledValue) {
@@ -646,7 +646,6 @@ __DEV__ &&
646646
(ReactSharedInternals.T = prevTransition);
647647
}
648648
}
649-
function noop() {}
650649
function addTransitionType(type) {
651650
if (enableViewTransition) {
652651
var transition = ReactSharedInternals.T;
@@ -1538,7 +1537,7 @@ __DEV__ &&
15381537
exports.useTransition = function () {
15391538
return resolveDispatcher().useTransition();
15401539
};
1541-
exports.version = "19.2.0-www-classic-ac068292-20250508";
1540+
exports.version = "19.2.0-www-classic-21fdf308-20250508";
15421541
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
15431542
"function" ===
15441543
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-dev.modern.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ __DEV__ &&
5959
this.refs = emptyObject;
6060
this.updater = updater || ReactNoopUpdateQueue;
6161
}
62+
function noop() {}
6263
function testStringCoercion(value) {
6364
return "" + value;
6465
}
@@ -383,7 +384,6 @@ __DEV__ &&
383384
? (checkKeyStringCoercion(element.key), escape("" + element.key))
384385
: index.toString(36);
385386
}
386-
function noop$1() {}
387387
function resolveThenable(thenable) {
388388
switch (thenable.status) {
389389
case "fulfilled":
@@ -393,7 +393,7 @@ __DEV__ &&
393393
default:
394394
switch (
395395
("string" === typeof thenable.status
396-
? thenable.then(noop$1, noop$1)
396+
? thenable.then(noop, noop)
397397
: ((thenable.status = "pending"),
398398
thenable.then(
399399
function (fulfilledValue) {
@@ -646,7 +646,6 @@ __DEV__ &&
646646
(ReactSharedInternals.T = prevTransition);
647647
}
648648
}
649-
function noop() {}
650649
function addTransitionType(type) {
651650
if (enableViewTransition) {
652651
var transition = ReactSharedInternals.T;
@@ -1538,7 +1537,7 @@ __DEV__ &&
15381537
exports.useTransition = function () {
15391538
return resolveDispatcher().useTransition();
15401539
};
1541-
exports.version = "19.2.0-www-modern-ac068292-20250508";
1540+
exports.version = "19.2.0-www-modern-21fdf308-20250508";
15421541
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
15431542
"function" ===
15441543
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-prod.classic.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,9 @@ var pureComponentPrototype = (PureComponent.prototype = new ComponentDummy());
9090
pureComponentPrototype.constructor = PureComponent;
9191
assign(pureComponentPrototype, Component.prototype);
9292
pureComponentPrototype.isPureReactComponent = !0;
93-
var isArrayImpl = Array.isArray,
94-
ReactSharedInternals = { H: null, A: null, T: null, S: null },
93+
var isArrayImpl = Array.isArray;
94+
function noop() {}
95+
var ReactSharedInternals = { H: null, A: null, T: null, S: null },
9596
hasOwnProperty = Object.prototype.hasOwnProperty;
9697
function ReactElement(type, key, self, source, owner, props) {
9798
self = props.ref;
@@ -152,7 +153,6 @@ function getElementKey(element, index) {
152153
? escape("" + element.key)
153154
: index.toString(36);
154155
}
155-
function noop$1() {}
156156
function resolveThenable(thenable) {
157157
switch (thenable.status) {
158158
case "fulfilled":
@@ -162,7 +162,7 @@ function resolveThenable(thenable) {
162162
default:
163163
switch (
164164
("string" === typeof thenable.status
165-
? thenable.then(noop$1, noop$1)
165+
? thenable.then(noop, noop)
166166
: ((thenable.status = "pending"),
167167
thenable.then(
168168
function (fulfilledValue) {
@@ -383,7 +383,6 @@ function startTransition(scope, options) {
383383
(ReactSharedInternals.T = prevTransition);
384384
}
385385
}
386-
function noop() {}
387386
function addTransitionType(type) {
388387
if (enableViewTransition) {
389388
var transition = ReactSharedInternals.T;
@@ -636,4 +635,4 @@ exports.useSyncExternalStore = function (
636635
exports.useTransition = function () {
637636
return ReactSharedInternals.H.useTransition();
638637
};
639-
exports.version = "19.2.0-www-classic-ac068292-20250508";
638+
exports.version = "19.2.0-www-classic-21fdf308-20250508";

compiled/facebook-www/React-prod.modern.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,9 @@ var pureComponentPrototype = (PureComponent.prototype = new ComponentDummy());
9090
pureComponentPrototype.constructor = PureComponent;
9191
assign(pureComponentPrototype, Component.prototype);
9292
pureComponentPrototype.isPureReactComponent = !0;
93-
var isArrayImpl = Array.isArray,
94-
ReactSharedInternals = { H: null, A: null, T: null, S: null },
93+
var isArrayImpl = Array.isArray;
94+
function noop() {}
95+
var ReactSharedInternals = { H: null, A: null, T: null, S: null },
9596
hasOwnProperty = Object.prototype.hasOwnProperty;
9697
function ReactElement(type, key, self, source, owner, props) {
9798
self = props.ref;
@@ -152,7 +153,6 @@ function getElementKey(element, index) {
152153
? escape("" + element.key)
153154
: index.toString(36);
154155
}
155-
function noop$1() {}
156156
function resolveThenable(thenable) {
157157
switch (thenable.status) {
158158
case "fulfilled":
@@ -162,7 +162,7 @@ function resolveThenable(thenable) {
162162
default:
163163
switch (
164164
("string" === typeof thenable.status
165-
? thenable.then(noop$1, noop$1)
165+
? thenable.then(noop, noop)
166166
: ((thenable.status = "pending"),
167167
thenable.then(
168168
function (fulfilledValue) {
@@ -383,7 +383,6 @@ function startTransition(scope, options) {
383383
(ReactSharedInternals.T = prevTransition);
384384
}
385385
}
386-
function noop() {}
387386
function addTransitionType(type) {
388387
if (enableViewTransition) {
389388
var transition = ReactSharedInternals.T;
@@ -636,4 +635,4 @@ exports.useSyncExternalStore = function (
636635
exports.useTransition = function () {
637636
return ReactSharedInternals.H.useTransition();
638637
};
639-
exports.version = "19.2.0-www-modern-ac068292-20250508";
638+
exports.version = "19.2.0-www-modern-21fdf308-20250508";

compiled/facebook-www/React-profiling.classic.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,9 @@ var pureComponentPrototype = (PureComponent.prototype = new ComponentDummy());
9494
pureComponentPrototype.constructor = PureComponent;
9595
assign(pureComponentPrototype, Component.prototype);
9696
pureComponentPrototype.isPureReactComponent = !0;
97-
var isArrayImpl = Array.isArray,
98-
ReactSharedInternals = { H: null, A: null, T: null, S: null },
97+
var isArrayImpl = Array.isArray;
98+
function noop() {}
99+
var ReactSharedInternals = { H: null, A: null, T: null, S: null },
99100
hasOwnProperty = Object.prototype.hasOwnProperty;
100101
function ReactElement(type, key, self, source, owner, props) {
101102
self = props.ref;
@@ -156,7 +157,6 @@ function getElementKey(element, index) {
156157
? escape("" + element.key)
157158
: index.toString(36);
158159
}
159-
function noop$1() {}
160160
function resolveThenable(thenable) {
161161
switch (thenable.status) {
162162
case "fulfilled":
@@ -166,7 +166,7 @@ function resolveThenable(thenable) {
166166
default:
167167
switch (
168168
("string" === typeof thenable.status
169-
? thenable.then(noop$1, noop$1)
169+
? thenable.then(noop, noop)
170170
: ((thenable.status = "pending"),
171171
thenable.then(
172172
function (fulfilledValue) {
@@ -387,7 +387,6 @@ function startTransition(scope, options) {
387387
(ReactSharedInternals.T = prevTransition);
388388
}
389389
}
390-
function noop() {}
391390
function addTransitionType(type) {
392391
if (enableViewTransition) {
393392
var transition = ReactSharedInternals.T;
@@ -640,7 +639,7 @@ exports.useSyncExternalStore = function (
640639
exports.useTransition = function () {
641640
return ReactSharedInternals.H.useTransition();
642641
};
643-
exports.version = "19.2.0-www-classic-ac068292-20250508";
642+
exports.version = "19.2.0-www-classic-21fdf308-20250508";
644643
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
645644
"function" ===
646645
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled/facebook-www/React-profiling.modern.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,9 @@ var pureComponentPrototype = (PureComponent.prototype = new ComponentDummy());
9494
pureComponentPrototype.constructor = PureComponent;
9595
assign(pureComponentPrototype, Component.prototype);
9696
pureComponentPrototype.isPureReactComponent = !0;
97-
var isArrayImpl = Array.isArray,
98-
ReactSharedInternals = { H: null, A: null, T: null, S: null },
97+
var isArrayImpl = Array.isArray;
98+
function noop() {}
99+
var ReactSharedInternals = { H: null, A: null, T: null, S: null },
99100
hasOwnProperty = Object.prototype.hasOwnProperty;
100101
function ReactElement(type, key, self, source, owner, props) {
101102
self = props.ref;
@@ -156,7 +157,6 @@ function getElementKey(element, index) {
156157
? escape("" + element.key)
157158
: index.toString(36);
158159
}
159-
function noop$1() {}
160160
function resolveThenable(thenable) {
161161
switch (thenable.status) {
162162
case "fulfilled":
@@ -166,7 +166,7 @@ function resolveThenable(thenable) {
166166
default:
167167
switch (
168168
("string" === typeof thenable.status
169-
? thenable.then(noop$1, noop$1)
169+
? thenable.then(noop, noop)
170170
: ((thenable.status = "pending"),
171171
thenable.then(
172172
function (fulfilledValue) {
@@ -387,7 +387,6 @@ function startTransition(scope, options) {
387387
(ReactSharedInternals.T = prevTransition);
388388
}
389389
}
390-
function noop() {}
391390
function addTransitionType(type) {
392391
if (enableViewTransition) {
393392
var transition = ReactSharedInternals.T;
@@ -640,7 +639,7 @@ exports.useSyncExternalStore = function (
640639
exports.useTransition = function () {
641640
return ReactSharedInternals.H.useTransition();
642641
};
643-
exports.version = "19.2.0-www-modern-ac068292-20250508";
642+
exports.version = "19.2.0-www-modern-21fdf308-20250508";
644643
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
645644
"function" ===
646645
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)