Skip to content

Commit ea9e061

Browse files
[compiler][rfc] Hacky retry pipeline for fire (facebook#32164)
Hacky retry pipeline for when transforming `fire(...)` calls encounters validation, todo, or memoization invariant bailouts. Would love feedback on how we implement this to be extensible to other compiler non-memoization features (e.g. inlineJSX) Some observations: - Compiler "front-end" passes (e.g. lower, type, effect, and mutability inferences) should be shared for all compiler features -- memo and otherwise - Many passes (anything dealing with reactive scope ranges, scope blocks / dependencies, and optimizations such as ReactiveIR facebook#31974) can be left out of the retry pipeline. This PR hackily skips memoization features by removing reactive scope creation, but we probably should restructure the pipeline to skip these entirely on a retry - We should maintain a canonical set of "validation flags" Note the newly added fixtures are prefixed with `bailout-...` when the retry fire pipeline is used. These fixture outputs contain correctly inserted `useFire` calls and no memoization. DiffTrain build for [152bfe3](facebook@152bfe3)
1 parent 03d11bb commit ea9e061

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+8604
-6543
lines changed

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

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,21 @@ __DEV__ &&
2222
_key2++
2323
)
2424
args[_key2 - 1] = arguments[_key2];
25-
_len2 = format;
26-
_key2 =
27-
require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
28-
null != _key2 &&
29-
_key2.getCurrentStack &&
30-
((_key2 = _key2.getCurrentStack()),
31-
"" !== _key2 && ((_len2 += "%s"), args.push(_key2)));
32-
args.unshift(_len2);
33-
args.unshift(!1);
34-
warningWWW.apply(null, args);
25+
if (enableRemoveConsolePatches) {
26+
var _console2;
27+
(_console2 = console).error.apply(_console2, [format].concat(args));
28+
} else
29+
(_len2 = format),
30+
enableRemoveConsolePatches ||
31+
((_key2 =
32+
require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE),
33+
null != _key2 &&
34+
_key2.getCurrentStack &&
35+
((_key2 = _key2.getCurrentStack()),
36+
"" !== _key2 && ((_len2 += "%s"), args.push(_key2))),
37+
args.unshift(_len2),
38+
args.unshift(!1),
39+
warningWWW.apply(null, args));
3540
}
3641
function getComponentNameFromType(type) {
3742
if (null == type) return null;
@@ -727,6 +732,8 @@ __DEV__ &&
727732
REACT_TRACING_MARKER_TYPE = Symbol.for("react.tracing_marker"),
728733
REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"),
729734
MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
735+
enableRemoveConsolePatches =
736+
require("ReactFeatureFlags").enableRemoveConsolePatches,
730737
warningWWW = require("warning"),
731738
REACT_CLIENT_REFERENCE$2 = Symbol.for("react.client.reference"),
732739
ReactSharedInternals =

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

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,21 @@ __DEV__ &&
2222
_key2++
2323
)
2424
args[_key2 - 1] = arguments[_key2];
25-
_len2 = format;
26-
_key2 =
27-
require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
28-
null != _key2 &&
29-
_key2.getCurrentStack &&
30-
((_key2 = _key2.getCurrentStack()),
31-
"" !== _key2 && ((_len2 += "%s"), args.push(_key2)));
32-
args.unshift(_len2);
33-
args.unshift(!1);
34-
warningWWW.apply(null, args);
25+
if (enableRemoveConsolePatches) {
26+
var _console2;
27+
(_console2 = console).error.apply(_console2, [format].concat(args));
28+
} else
29+
(_len2 = format),
30+
enableRemoveConsolePatches ||
31+
((_key2 =
32+
require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE),
33+
null != _key2 &&
34+
_key2.getCurrentStack &&
35+
((_key2 = _key2.getCurrentStack()),
36+
"" !== _key2 && ((_len2 += "%s"), args.push(_key2))),
37+
args.unshift(_len2),
38+
args.unshift(!1),
39+
warningWWW.apply(null, args));
3540
}
3641
function getComponentNameFromType(type) {
3742
if (null == type) return null;
@@ -727,6 +732,8 @@ __DEV__ &&
727732
REACT_TRACING_MARKER_TYPE = Symbol.for("react.tracing_marker"),
728733
REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"),
729734
MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
735+
enableRemoveConsolePatches =
736+
require("ReactFeatureFlags").enableRemoveConsolePatches,
730737
warningWWW = require("warning"),
731738
REACT_CLIENT_REFERENCE$2 = Symbol.for("react.client.reference"),
732739
ReactSharedInternals =

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0bf1f39ec6906c666011c0c57aa56aa34a262daf
1+
152bfe3769f87e29c8d68cb87fdb608d2483b7f1
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0bf1f39ec6906c666011c0c57aa56aa34a262daf
1+
152bfe3769f87e29c8d68cb87fdb608d2483b7f1

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

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ __DEV__ &&
4141
_key++
4242
)
4343
args[_key - 1] = arguments[_key];
44-
printWarning("warn", format, args);
44+
if (enableRemoveConsolePatches) {
45+
var _console;
46+
(_console = console).warn.apply(_console, [format].concat(args));
47+
} else printWarning("warn", format, args);
4548
}
4649
function error$jscomp$0(format) {
4750
for (
@@ -52,18 +55,22 @@ __DEV__ &&
5255
_key2++
5356
)
5457
args[_key2 - 1] = arguments[_key2];
55-
printWarning("error", format, args);
58+
if (enableRemoveConsolePatches) {
59+
var _console2;
60+
(_console2 = console).error.apply(_console2, [format].concat(args));
61+
} else printWarning("error", format, args);
5662
}
5763
function printWarning(level, format, args) {
58-
level =
59-
require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
60-
null != level &&
61-
level.getCurrentStack &&
62-
((level = level.getCurrentStack()),
63-
"" !== level && ((format += "%s"), args.push(level)));
64-
args.unshift(format);
65-
args.unshift(!1);
66-
warningWWW.apply(null, args);
64+
enableRemoveConsolePatches ||
65+
((level =
66+
require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE),
67+
null != level &&
68+
level.getCurrentStack &&
69+
((level = level.getCurrentStack()),
70+
"" !== level && ((format += "%s"), args.push(level))),
71+
args.unshift(format),
72+
args.unshift(!1),
73+
warningWWW.apply(null, args));
6774
}
6875
function warnNoop(publicInstance, callerName) {
6976
publicInstance =
@@ -685,7 +692,8 @@ __DEV__ &&
685692
enableOwnerStacks ? oldElement._debugStack : void 0,
686693
enableOwnerStacks ? oldElement._debugTask : void 0
687694
);
688-
newKey._store.validated = oldElement._store.validated;
695+
oldElement._store &&
696+
(newKey._store.validated = oldElement._store.validated);
689697
return newKey;
690698
}
691699
function validateChildKeys(node, parentType) {
@@ -1139,6 +1147,8 @@ __DEV__ &&
11391147
REACT_TRACING_MARKER_TYPE = Symbol.for("react.tracing_marker"),
11401148
REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"),
11411149
MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
1150+
enableRemoveConsolePatches =
1151+
require("ReactFeatureFlags").enableRemoveConsolePatches,
11421152
warningWWW = require("warning"),
11431153
didWarnStateUpdateForUnmountedComponent = {},
11441154
ReactNoopUpdateQueue = {
@@ -1200,6 +1210,7 @@ __DEV__ &&
12001210
A: null,
12011211
T: null,
12021212
S: null,
1213+
V: null,
12031214
actQueue: null,
12041215
isBatchingLegacy: !1,
12051216
didScheduleLegacyUpdate: !1,
@@ -1280,7 +1291,10 @@ __DEV__ &&
12801291
});
12811292
}
12821293
: enqueueTask,
1283-
ReactCompilerRuntime = { c: useMemoCache },
1294+
ReactCompilerRuntime = Object.freeze({
1295+
__proto__: null,
1296+
c: useMemoCache
1297+
}),
12841298
Children = {
12851299
map: mapChildren,
12861300
forEach: function (children, forEachFunc, forEachContext) {
@@ -1944,7 +1958,7 @@ __DEV__ &&
19441958
exports.useTransition = function () {
19451959
return resolveDispatcher().useTransition();
19461960
};
1947-
exports.version = "19.1.0-www-classic-0bf1f39e-20250110";
1961+
exports.version = "19.1.0-www-classic-152bfe37-20250131";
19481962
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
19491963
"function" ===
19501964
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ __DEV__ &&
4141
_key++
4242
)
4343
args[_key - 1] = arguments[_key];
44-
printWarning("warn", format, args);
44+
if (enableRemoveConsolePatches) {
45+
var _console;
46+
(_console = console).warn.apply(_console, [format].concat(args));
47+
} else printWarning("warn", format, args);
4548
}
4649
function error$jscomp$0(format) {
4750
for (
@@ -52,18 +55,22 @@ __DEV__ &&
5255
_key2++
5356
)
5457
args[_key2 - 1] = arguments[_key2];
55-
printWarning("error", format, args);
58+
if (enableRemoveConsolePatches) {
59+
var _console2;
60+
(_console2 = console).error.apply(_console2, [format].concat(args));
61+
} else printWarning("error", format, args);
5662
}
5763
function printWarning(level, format, args) {
58-
level =
59-
require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
60-
null != level &&
61-
level.getCurrentStack &&
62-
((level = level.getCurrentStack()),
63-
"" !== level && ((format += "%s"), args.push(level)));
64-
args.unshift(format);
65-
args.unshift(!1);
66-
warningWWW.apply(null, args);
64+
enableRemoveConsolePatches ||
65+
((level =
66+
require("react").__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE),
67+
null != level &&
68+
level.getCurrentStack &&
69+
((level = level.getCurrentStack()),
70+
"" !== level && ((format += "%s"), args.push(level))),
71+
args.unshift(format),
72+
args.unshift(!1),
73+
warningWWW.apply(null, args));
6774
}
6875
function warnNoop(publicInstance, callerName) {
6976
publicInstance =
@@ -685,7 +692,8 @@ __DEV__ &&
685692
enableOwnerStacks ? oldElement._debugStack : void 0,
686693
enableOwnerStacks ? oldElement._debugTask : void 0
687694
);
688-
newKey._store.validated = oldElement._store.validated;
695+
oldElement._store &&
696+
(newKey._store.validated = oldElement._store.validated);
689697
return newKey;
690698
}
691699
function validateChildKeys(node, parentType) {
@@ -1139,6 +1147,8 @@ __DEV__ &&
11391147
REACT_TRACING_MARKER_TYPE = Symbol.for("react.tracing_marker"),
11401148
REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"),
11411149
MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
1150+
enableRemoveConsolePatches =
1151+
require("ReactFeatureFlags").enableRemoveConsolePatches,
11421152
warningWWW = require("warning"),
11431153
didWarnStateUpdateForUnmountedComponent = {},
11441154
ReactNoopUpdateQueue = {
@@ -1200,6 +1210,7 @@ __DEV__ &&
12001210
A: null,
12011211
T: null,
12021212
S: null,
1213+
V: null,
12031214
actQueue: null,
12041215
isBatchingLegacy: !1,
12051216
didScheduleLegacyUpdate: !1,
@@ -1280,7 +1291,10 @@ __DEV__ &&
12801291
});
12811292
}
12821293
: enqueueTask,
1283-
ReactCompilerRuntime = { c: useMemoCache },
1294+
ReactCompilerRuntime = Object.freeze({
1295+
__proto__: null,
1296+
c: useMemoCache
1297+
}),
12841298
Children = {
12851299
map: mapChildren,
12861300
forEach: function (children, forEachFunc, forEachContext) {
@@ -1944,7 +1958,7 @@ __DEV__ &&
19441958
exports.useTransition = function () {
19451959
return resolveDispatcher().useTransition();
19461960
};
1947-
exports.version = "19.1.0-www-modern-0bf1f39e-20250110";
1961+
exports.version = "19.1.0-www-modern-152bfe37-20250131";
19481962
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
19491963
"function" ===
19501964
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ pureComponentPrototype.constructor = PureComponent;
9090
assign(pureComponentPrototype, Component.prototype);
9191
pureComponentPrototype.isPureReactComponent = !0;
9292
var isArrayImpl = Array.isArray,
93-
ReactSharedInternals = { H: null, A: null, T: null, S: null },
93+
ReactSharedInternals = { H: null, A: null, T: null, S: null, V: null },
9494
hasOwnProperty = Object.prototype.hasOwnProperty;
9595
function ReactElement(type, key, self, source, owner, props) {
9696
self = props.ref;
@@ -364,7 +364,7 @@ var reportGlobalError =
364364
console.error(error);
365365
};
366366
function noop() {}
367-
var ReactCompilerRuntime = { c: useMemoCache },
367+
var ReactCompilerRuntime = { __proto__: null, c: useMemoCache },
368368
experimental_useResourceEffect = enableUseResourceEffectHook
369369
? useResourceEffect
370370
: void 0;
@@ -630,4 +630,4 @@ exports.useSyncExternalStore = function (
630630
exports.useTransition = function () {
631631
return ReactSharedInternals.H.useTransition();
632632
};
633-
exports.version = "19.1.0-www-classic-0bf1f39e-20250110";
633+
exports.version = "19.1.0-www-classic-152bfe37-20250131";

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ pureComponentPrototype.constructor = PureComponent;
9090
assign(pureComponentPrototype, Component.prototype);
9191
pureComponentPrototype.isPureReactComponent = !0;
9292
var isArrayImpl = Array.isArray,
93-
ReactSharedInternals = { H: null, A: null, T: null, S: null },
93+
ReactSharedInternals = { H: null, A: null, T: null, S: null, V: null },
9494
hasOwnProperty = Object.prototype.hasOwnProperty;
9595
function ReactElement(type, key, self, source, owner, props) {
9696
self = props.ref;
@@ -364,7 +364,7 @@ var reportGlobalError =
364364
console.error(error);
365365
};
366366
function noop() {}
367-
var ReactCompilerRuntime = { c: useMemoCache },
367+
var ReactCompilerRuntime = { __proto__: null, c: useMemoCache },
368368
experimental_useResourceEffect = enableUseResourceEffectHook
369369
? useResourceEffect
370370
: void 0;
@@ -630,4 +630,4 @@ exports.useSyncExternalStore = function (
630630
exports.useTransition = function () {
631631
return ReactSharedInternals.H.useTransition();
632632
};
633-
exports.version = "19.1.0-www-modern-0bf1f39e-20250110";
633+
exports.version = "19.1.0-www-modern-152bfe37-20250131";

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pureComponentPrototype.constructor = PureComponent;
9494
assign(pureComponentPrototype, Component.prototype);
9595
pureComponentPrototype.isPureReactComponent = !0;
9696
var isArrayImpl = Array.isArray,
97-
ReactSharedInternals = { H: null, A: null, T: null, S: null },
97+
ReactSharedInternals = { H: null, A: null, T: null, S: null, V: null },
9898
hasOwnProperty = Object.prototype.hasOwnProperty;
9999
function ReactElement(type, key, self, source, owner, props) {
100100
self = props.ref;
@@ -368,7 +368,7 @@ var reportGlobalError =
368368
console.error(error);
369369
};
370370
function noop() {}
371-
var ReactCompilerRuntime = { c: useMemoCache },
371+
var ReactCompilerRuntime = { __proto__: null, c: useMemoCache },
372372
experimental_useResourceEffect = enableUseResourceEffectHook
373373
? useResourceEffect
374374
: void 0;
@@ -634,7 +634,7 @@ exports.useSyncExternalStore = function (
634634
exports.useTransition = function () {
635635
return ReactSharedInternals.H.useTransition();
636636
};
637-
exports.version = "19.1.0-www-classic-0bf1f39e-20250110";
637+
exports.version = "19.1.0-www-classic-152bfe37-20250131";
638638
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
639639
"function" ===
640640
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pureComponentPrototype.constructor = PureComponent;
9494
assign(pureComponentPrototype, Component.prototype);
9595
pureComponentPrototype.isPureReactComponent = !0;
9696
var isArrayImpl = Array.isArray,
97-
ReactSharedInternals = { H: null, A: null, T: null, S: null },
97+
ReactSharedInternals = { H: null, A: null, T: null, S: null, V: null },
9898
hasOwnProperty = Object.prototype.hasOwnProperty;
9999
function ReactElement(type, key, self, source, owner, props) {
100100
self = props.ref;
@@ -368,7 +368,7 @@ var reportGlobalError =
368368
console.error(error);
369369
};
370370
function noop() {}
371-
var ReactCompilerRuntime = { c: useMemoCache },
371+
var ReactCompilerRuntime = { __proto__: null, c: useMemoCache },
372372
experimental_useResourceEffect = enableUseResourceEffectHook
373373
? useResourceEffect
374374
: void 0;
@@ -634,7 +634,7 @@ exports.useSyncExternalStore = function (
634634
exports.useTransition = function () {
635635
return ReactSharedInternals.H.useTransition();
636636
};
637-
exports.version = "19.1.0-www-modern-0bf1f39e-20250110";
637+
exports.version = "19.1.0-www-modern-152bfe37-20250131";
638638
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
639639
"function" ===
640640
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)