[compiler] In change detection, be less precise about path dependencies

ghstack-source-id: 0d3837641c
Pull Request resolved: https://github.com/facebook/react/pull/30489
This commit is contained in:
Mike Vitousek
2024-07-26 15:52:23 -07:00
parent 0544af4dcc
commit b1dbc5955e
@@ -1442,7 +1442,11 @@ function codegenDependency(
): t.Expression {
let object: t.Expression = convertIdentifier(dependency.identifier);
if (dependency.path !== null) {
for (const path of dependency.path) {
let depPath = dependency.path;
if (cx.env.config.enableChangeDetection != null && depPath.length > 0) {
depPath = depPath.slice(0, -1)
}
for (const path of depPath) {
object = t.memberExpression(object, t.identifier(path));
}
}