Skip to content

Commit 0f0f8e9

Browse files
author
22388o
committed
[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 709b610 commit 0f0f8e9

37 files changed

+4301
-3915
lines changed

compiled/facebook-www/REVISION

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

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,8 @@ __DEV__ &&
692692
enableOwnerStacks ? oldElement._debugStack : void 0,
693693
enableOwnerStacks ? oldElement._debugTask : void 0
694694
);
695-
newKey._store.validated = oldElement._store.validated;
695+
oldElement._store &&
696+
(newKey._store.validated = oldElement._store.validated);
696697
return newKey;
697698
}
698699
function validateChildKeys(node, parentType) {
@@ -1209,6 +1210,7 @@ __DEV__ &&
12091210
A: null,
12101211
T: null,
12111212
S: null,
1213+
V: null,
12121214
actQueue: null,
12131215
isBatchingLegacy: !1,
12141216
didScheduleLegacyUpdate: !1,
@@ -1956,7 +1958,7 @@ __DEV__ &&
19561958
exports.useTransition = function () {
19571959
return resolveDispatcher().useTransition();
19581960
};
1959-
exports.version = "19.1.0-www-classic-18eaf51b-20250118";
1961+
exports.version = "19.1.0-www-classic-152bfe37-20250131";
19601962
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
19611963
"function" ===
19621964
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,8 @@ __DEV__ &&
692692
enableOwnerStacks ? oldElement._debugStack : void 0,
693693
enableOwnerStacks ? oldElement._debugTask : void 0
694694
);
695-
newKey._store.validated = oldElement._store.validated;
695+
oldElement._store &&
696+
(newKey._store.validated = oldElement._store.validated);
696697
return newKey;
697698
}
698699
function validateChildKeys(node, parentType) {
@@ -1209,6 +1210,7 @@ __DEV__ &&
12091210
A: null,
12101211
T: null,
12111212
S: null,
1213+
V: null,
12121214
actQueue: null,
12131215
isBatchingLegacy: !1,
12141216
didScheduleLegacyUpdate: !1,
@@ -1956,7 +1958,7 @@ __DEV__ &&
19561958
exports.useTransition = function () {
19571959
return resolveDispatcher().useTransition();
19581960
};
1959-
exports.version = "19.1.0-www-modern-18eaf51b-20250118";
1961+
exports.version = "19.1.0-www-modern-152bfe37-20250131";
19601962
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
19611963
"function" ===
19621964
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

Lines changed: 2 additions & 2 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;
@@ -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-18eaf51b-20250118";
633+
exports.version = "19.1.0-www-classic-152bfe37-20250131";

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

Lines changed: 2 additions & 2 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;
@@ -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-18eaf51b-20250118";
633+
exports.version = "19.1.0-www-modern-152bfe37-20250131";

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

Lines changed: 2 additions & 2 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;
@@ -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-18eaf51b-20250118";
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: 2 additions & 2 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;
@@ -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-18eaf51b-20250118";
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 &&

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

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3922,7 +3922,7 @@ __DEV__ &&
39223922
),
39233923
node.isTransition ||
39243924
error$jscomp$0(
3925-
"An async function was passed to useActionState, but it was dispatched outside of an action context. This is likely not what you intended. Either pass the dispatch function to an `action` prop, or dispatch manually inside `startTransition`"
3925+
"An async function with useActionState was called outside of a transition. This is likely not what you intended (for example, isPending will not update correctly). Either call the returned function inside startTransition, or pass it to an `action` or `formAction` prop."
39263926
))
39273927
: onActionSuccess(actionQueue, node, returnValue);
39283928
}
@@ -10380,8 +10380,8 @@ __DEV__ &&
1038010380
}
1038110381
finishedRoot.effectDuration += popNestedEffectDurations(current);
1038210382
break;
10383-
case 26:
1038410383
case 27:
10384+
case 26:
1038510385
case 5:
1038610386
recursivelyTraverseLayoutEffects(finishedRoot, finishedWork);
1038710387
null === current && flags & 4 && commitHostMount(finishedWork);
@@ -10917,9 +10917,6 @@ __DEV__ &&
1091710917
hostParentIsContainer = !1;
1091810918
break a;
1091910919
case 3:
10920-
hostParent = parent.stateNode.containerInfo;
10921-
hostParentIsContainer = !0;
10922-
break a;
1092310920
case 4:
1092410921
hostParent = parent.stateNode.containerInfo;
1092510922
hostParentIsContainer = !0;
@@ -11140,10 +11137,10 @@ __DEV__ &&
1114011137
? root._visibility & -2
1114111138
: root._visibility | 1),
1114211139
suspenseCallback &&
11143-
((root = offscreenSubtreeIsHidden || offscreenSubtreeWasHidden),
11144-
null === current ||
11140+
(null === current ||
1114511141
retryQueue ||
11146-
root ||
11142+
offscreenSubtreeIsHidden ||
11143+
offscreenSubtreeWasHidden ||
1114711144
recursivelyTraverseDisappearLayoutEffects(finishedWork)),
1114811145
null === finishedWork.memoizedProps ||
1114911146
"manual" !== finishedWork.memoizedProps.mode)
@@ -11292,8 +11289,8 @@ __DEV__ &&
1129211289
);
1129311290
recursivelyTraverseDisappearLayoutEffects(finishedWork);
1129411291
break;
11295-
case 26:
1129611292
case 27:
11293+
case 26:
1129711294
case 5:
1129811295
safelyDetachRef(finishedWork, finishedWork.return);
1129911296
recursivelyTraverseDisappearLayoutEffects(finishedWork);
@@ -11367,8 +11364,8 @@ __DEV__ &&
1136711364
commitClassCallbacks(finishedWork);
1136811365
safelyAttachRef(finishedWork, finishedWork.return);
1136911366
break;
11370-
case 26:
1137111367
case 27:
11368+
case 26:
1137211369
case 5:
1137311370
recursivelyTraverseReappearLayoutEffects(
1137411371
finishedRoot,
@@ -12469,7 +12466,6 @@ __DEV__ &&
1246912466
lanes,
1247012467
workInProgressRootRecoverableErrors,
1247112468
workInProgressTransitions,
12472-
workInProgressAppearingViewTransitions,
1247312469
workInProgressRootDidIncludeRecursiveRenderUpdate,
1247412470
workInProgressDeferredLane,
1247512471
workInProgressRootInterleavedUpdatedLanes,
@@ -12499,7 +12495,6 @@ __DEV__ &&
1249912495
forceSync,
1250012496
workInProgressRootRecoverableErrors,
1250112497
workInProgressTransitions,
12502-
workInProgressAppearingViewTransitions,
1250312498
workInProgressRootDidIncludeRecursiveRenderUpdate,
1250412499
lanes,
1250512500
workInProgressDeferredLane,
@@ -12520,7 +12515,6 @@ __DEV__ &&
1252012515
forceSync,
1252112516
workInProgressRootRecoverableErrors,
1252212517
workInProgressTransitions,
12523-
workInProgressAppearingViewTransitions,
1252412518
workInProgressRootDidIncludeRecursiveRenderUpdate,
1252512519
lanes,
1252612520
workInProgressDeferredLane,
@@ -12544,7 +12538,6 @@ __DEV__ &&
1254412538
finishedWork,
1254512539
recoverableErrors,
1254612540
transitions,
12547-
appearingViewTransitions,
1254812541
didIncludeRenderPhaseUpdate,
1254912542
lanes,
1255012543
spawnedLane,
@@ -12553,17 +12546,14 @@ __DEV__ &&
1255312546
) {
1255412547
root.timeoutHandle = -1;
1255512548
var subtreeFlags = finishedWork.subtreeFlags;
12556-
(subtreeFlags =
12557-
subtreeFlags & 8192 || 16785408 === (subtreeFlags & 16785408)) &&
12558-
subtreeFlags &&
12549+
(subtreeFlags & 8192 || 16785408 === (subtreeFlags & 16785408)) &&
1255912550
accumulateSuspenseyCommitOnFiber(finishedWork);
1256012551
commitRoot(
1256112552
root,
1256212553
finishedWork,
1256312554
lanes,
1256412555
recoverableErrors,
1256512556
transitions,
12566-
appearingViewTransitions,
1256712557
didIncludeRenderPhaseUpdate,
1256812558
spawnedLane,
1256912559
updatedLanes,
@@ -12688,7 +12678,6 @@ __DEV__ &&
1268812678
workInProgressRootRecoverableErrors = workInProgressRootConcurrentErrors =
1268912679
null;
1269012680
workInProgressRootDidIncludeRecursiveRenderUpdate = !1;
12691-
workInProgressAppearingViewTransitions = null;
1269212681
0 !== (lanes & 8) && (lanes |= lanes & 32);
1269312682
var allEntangledLanes = root.entangledLanes;
1269412683
if (0 !== allEntangledLanes)
@@ -13306,7 +13295,6 @@ __DEV__ &&
1330613295
lanes,
1330713296
recoverableErrors,
1330813297
transitions,
13309-
appearingViewTransitions,
1331013298
didIncludeRenderPhaseUpdate,
1331113299
spawnedLane,
1331213300
updatedLanes,
@@ -13375,12 +13363,7 @@ __DEV__ &&
1337513363
didIncludeRenderPhaseUpdate = executionContext;
1337613364
executionContext |= CommitContext;
1337713365
try {
13378-
commitBeforeMutationEffects(
13379-
root,
13380-
finishedWork,
13381-
lanes,
13382-
appearingViewTransitions
13383-
);
13366+
commitBeforeMutationEffects(root, finishedWork, lanes);
1338413367
} finally {
1338513368
(executionContext = didIncludeRenderPhaseUpdate),
1338613369
(currentUpdatePriority = transitions),
@@ -16691,7 +16674,6 @@ __DEV__ &&
1669116674
workInProgressSuspendedRetryLanes = 0,
1669216675
workInProgressRootConcurrentErrors = null,
1669316676
workInProgressRootRecoverableErrors = null,
16694-
workInProgressAppearingViewTransitions = null,
1669516677
workInProgressRootDidIncludeRecursiveRenderUpdate = !1,
1669616678
didIncludeCommitPhaseUpdate = !1,
1669716679
globalMostRecentFallbackTime = 0,
@@ -16950,10 +16932,10 @@ __DEV__ &&
1695016932
(function () {
1695116933
var internals = {
1695216934
bundleType: 1,
16953-
version: "19.1.0-www-classic-18eaf51b-20250118",
16935+
version: "19.1.0-www-classic-152bfe37-20250131",
1695416936
rendererPackageName: "react-art",
1695516937
currentDispatcherRef: ReactSharedInternals,
16956-
reconcilerVersion: "19.1.0-www-classic-18eaf51b-20250118"
16938+
reconcilerVersion: "19.1.0-www-classic-152bfe37-20250131"
1695716939
};
1695816940
internals.overrideHookState = overrideHookState;
1695916941
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -16987,7 +16969,7 @@ __DEV__ &&
1698716969
exports.Shape = Shape;
1698816970
exports.Surface = Surface;
1698916971
exports.Text = Text;
16990-
exports.version = "19.1.0-www-classic-18eaf51b-20250118";
16972+
exports.version = "19.1.0-www-classic-152bfe37-20250131";
1699116973
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1699216974
"function" ===
1699316975
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)