mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[λ] Fix mutatedDep collection in AnalyseFunctions
Make sure to check free variables as well for mutations. Not just object properties.
This commit is contained in:
@@ -85,6 +85,11 @@ function buildMutatedDeps(
|
||||
continue;
|
||||
}
|
||||
|
||||
mutatedDeps.push(dep);
|
||||
} else if (
|
||||
dep.identifier.name !== null &&
|
||||
mutatedIds.has(dep.identifier.name)
|
||||
) {
|
||||
mutatedDeps.push(dep);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,18 +19,20 @@ function component(a) {
|
||||
```javascript
|
||||
function component(a) {
|
||||
const $ = React.useMemoCache();
|
||||
const c_0 = $[0] !== a;
|
||||
let y;
|
||||
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
if (c_0) {
|
||||
y = function () {
|
||||
m(x);
|
||||
};
|
||||
$[0] = y;
|
||||
} else {
|
||||
y = $[0];
|
||||
}
|
||||
|
||||
const x = { a: a };
|
||||
m(x);
|
||||
const x = { a: a };
|
||||
m(x);
|
||||
$[0] = a;
|
||||
$[1] = y;
|
||||
} else {
|
||||
y = $[1];
|
||||
}
|
||||
return y;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user