Skip to content

Commit 819c414

Browse files
committed
Update on "[compiler] rfc: Include location information in identifiers and reactive scopes for debugging"
Summary: Using the change detection code to debug codebases that violate the rules of react is a lot easier when we have a source location corresponding to the value that has changed inappropriately. I didn't see an easy way to track that information in the existing data structures at the point of codegen, so this PR adds locations to identifiers and reactive scopes (the location of a reactive scope is the range of the locations of its included identifiers). I'm interested if there's a better way to do this that I missed! [ghstack-poisoned]
2 parents 9d9bd74 + 35cbbb4 commit 819c414

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/change-detect-reassign.expect.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ function Component(props) {
2929
let condition = $[0] !== props.value;
3030
if (!condition) {
3131
let old$x = $[1];
32-
$structuralCheck(old$x, x, "x", "Component", "cached");
32+
$structuralCheck(old$x, x, "x", "Component", "cached", "(3:6)");
3333
}
3434
$[0] = props.value;
3535
$[1] = x;
3636
if (condition) {
3737
x = [];
3838
x.push(props.value);
39-
$structuralCheck($[1], x, "x", "Component", "recomputed");
39+
$structuralCheck($[1], x, "x", "Component", "recomputed", "(3:6)");
4040
x = $[1];
4141
}
4242
}

0 commit comments

Comments
 (0)