Skip to content

Commit 5cd660b

Browse files
committed
InferEffectDeps takes a React.AUTODEPS sigil (facebook#33799)
--- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/33799). * facebook#33800 * __->__ facebook#33799 DiffTrain build for [dffacc7](facebook@dffacc7)
1 parent 0af6152 commit 5cd660b

35 files changed

+108
-90
lines changed

compiled/eslint-plugin-react-hooks/index.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20860,6 +20860,7 @@ const BuiltInFireId = 'BuiltInFire';
2086020860
const BuiltInFireFunctionId = 'BuiltInFireFunction';
2086120861
const BuiltInUseEffectEventId = 'BuiltInUseEffectEvent';
2086220862
const BuiltinEffectEventId = 'BuiltInEffectEventFunction';
20863+
const BuiltInAutodepsId = 'BuiltInAutoDepsId';
2086320864
const ReanimatedSharedValueId = 'ReanimatedSharedValueId';
2086420865
const BUILTIN_SHAPES = new Map();
2086520866
addObject(BUILTIN_SHAPES, BuiltInPropsId, [
@@ -29728,6 +29729,7 @@ const REACT_APIS = [
2972829729
returnValueKind: ValueKind.Frozen,
2972929730
}, BuiltInUseEffectEventId),
2973029731
],
29732+
['AUTODEPS', addObject(DEFAULT_SHAPES, BuiltInAutodepsId, [])],
2973129733
];
2973229734
TYPED_GLOBALS.push([
2973329735
'React',
@@ -45235,7 +45237,12 @@ function inferEffectDependencies(fn) {
4523545237
else if (value.kind === 'CallExpression' ||
4523645238
value.kind === 'MethodCall') {
4523745239
const callee = value.kind === 'CallExpression' ? value.callee : value.property;
45238-
if (value.args.length === autodepFnLoads.get(callee.identifier.id) &&
45240+
const autodepsArgIndex = value.args.findIndex(arg => arg.kind === 'Identifier' &&
45241+
arg.identifier.type.kind === 'Object' &&
45242+
arg.identifier.type.shapeId === BuiltInAutodepsId);
45243+
if (value.args.length > 1 &&
45244+
autodepsArgIndex > 0 &&
45245+
autodepFnLoads.has(callee.identifier.id) &&
4523945246
value.args[0].kind === 'Identifier') {
4524045247
const effectDeps = [];
4524145248
const deps = {
@@ -45302,7 +45309,7 @@ function inferEffectDependencies(fn) {
4530245309
effects: null,
4530345310
},
4530445311
});
45305-
value.args.push(Object.assign(Object.assign({}, depsPlace), { effect: Effect.Freeze }));
45312+
value.args[autodepsArgIndex] = Object.assign(Object.assign({}, depsPlace), { effect: Effect.Freeze });
4530645313
fn.env.inferredEffectLocations.add(callee.loc);
4530745314
}
4530845315
else if (loadGlobals.has(value.args[0].identifier.id)) {
@@ -45317,7 +45324,7 @@ function inferEffectDependencies(fn) {
4531745324
effects: null,
4531845325
},
4531945326
});
45320-
value.args.push(Object.assign(Object.assign({}, depsPlace), { effect: Effect.Freeze }));
45327+
value.args[autodepsArgIndex] = Object.assign(Object.assign({}, depsPlace), { effect: Effect.Freeze });
4532145328
fn.env.inferredEffectLocations.add(callee.loc);
4532245329
}
4532345330
}
@@ -45351,6 +45358,7 @@ function inferEffectDependencies(fn) {
4535145358
markPredecessors(fn.body);
4535245359
markInstructionIds(fn.body);
4535345360
fixScopeAndIdentifierRanges(fn.body);
45361+
deadCodeElimination(fn);
4535445362
fn.env.hasInferredEffect = true;
4535545363
}
4535645364
}
@@ -45387,7 +45395,7 @@ function rewriteSplices(originalBlock, splices, rewriteBlocks) {
4538745395
if (rewrite.kind === 'instr') {
4538845396
currBlock.instructions.push(rewrite.value);
4538945397
}
45390-
else {
45398+
else if (rewrite.kind === 'block') {
4539145399
const { entry, blocks } = rewrite.value;
4539245400
const entryBlock = blocks.get(entry);
4539345401
currBlock.instructions.push(...entryBlock.instructions);

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
fe813143e23675963f92d25fa1fb35b39db40272
1+
dffacc7b8094576c19790fe8341996f743ba4a89
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
fe813143e23675963f92d25fa1fb35b39db40272
1+
dffacc7b8094576c19790fe8341996f743ba4a89

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1434,7 +1434,7 @@ __DEV__ &&
14341434
exports.useTransition = function () {
14351435
return resolveDispatcher().useTransition();
14361436
};
1437-
exports.version = "19.2.0-www-classic-fe813143-20250715";
1437+
exports.version = "19.2.0-www-classic-dffacc7b-20250717";
14381438
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
14391439
"function" ===
14401440
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1434,7 +1434,7 @@ __DEV__ &&
14341434
exports.useTransition = function () {
14351435
return resolveDispatcher().useTransition();
14361436
};
1437-
exports.version = "19.2.0-www-modern-fe813143-20250715";
1437+
exports.version = "19.2.0-www-modern-dffacc7b-20250717";
14381438
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
14391439
"function" ===
14401440
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,4 +610,4 @@ exports.useSyncExternalStore = function (
610610
exports.useTransition = function () {
611611
return ReactSharedInternals.H.useTransition();
612612
};
613-
exports.version = "19.2.0-www-classic-fe813143-20250715";
613+
exports.version = "19.2.0-www-classic-dffacc7b-20250717";

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,4 +610,4 @@ exports.useSyncExternalStore = function (
610610
exports.useTransition = function () {
611611
return ReactSharedInternals.H.useTransition();
612612
};
613-
exports.version = "19.2.0-www-modern-fe813143-20250715";
613+
exports.version = "19.2.0-www-modern-dffacc7b-20250717";

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ exports.useSyncExternalStore = function (
614614
exports.useTransition = function () {
615615
return ReactSharedInternals.H.useTransition();
616616
};
617-
exports.version = "19.2.0-www-classic-fe813143-20250715";
617+
exports.version = "19.2.0-www-classic-dffacc7b-20250717";
618618
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
619619
"function" ===
620620
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ exports.useSyncExternalStore = function (
614614
exports.useTransition = function () {
615615
return ReactSharedInternals.H.useTransition();
616616
};
617-
exports.version = "19.2.0-www-modern-fe813143-20250715";
617+
exports.version = "19.2.0-www-modern-dffacc7b-20250717";
618618
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
619619
"function" ===
620620
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13479,6 +13479,7 @@ __DEV__ &&
1347913479
prevEffectErrors = pushComponentEffectErrors(),
1348013480
prevDeepEquality = alreadyWarnedForDeepEquality;
1348113481
enableComponentPerformanceTrack &&
13482+
includeWorkInProgressEffects &&
1348213483
0 !== (finishedWork.mode & 2) &&
1348313484
0 < finishedWork.actualStartTime &&
1348413485
0 !== (finishedWork.flags & 1) &&
@@ -19299,10 +19300,10 @@ __DEV__ &&
1929919300
(function () {
1930019301
var internals = {
1930119302
bundleType: 1,
19302-
version: "19.2.0-www-classic-fe813143-20250715",
19303+
version: "19.2.0-www-classic-dffacc7b-20250717",
1930319304
rendererPackageName: "react-art",
1930419305
currentDispatcherRef: ReactSharedInternals,
19305-
reconcilerVersion: "19.2.0-www-classic-fe813143-20250715"
19306+
reconcilerVersion: "19.2.0-www-classic-dffacc7b-20250717"
1930619307
};
1930719308
internals.overrideHookState = overrideHookState;
1930819309
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -19336,7 +19337,7 @@ __DEV__ &&
1933619337
exports.Shape = Shape;
1933719338
exports.Surface = Surface;
1933819339
exports.Text = Text;
19339-
exports.version = "19.2.0-www-classic-fe813143-20250715";
19340+
exports.version = "19.2.0-www-classic-dffacc7b-20250717";
1934019341
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
1934119342
"function" ===
1934219343
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)