mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
474c38c573e4a56ff3f8eb31bb22c9c65895118e
--- Our current compiler has specific logic for determining what can be a reactive value / reactive dependency. Currently, all of the following affect whether an identifier is a reactive: - **alias analysis** (applicable to objects) - **data + control flow** (whether any other reactive identifiers is used in determining it) - **reactive scopes** (we generalize and say anything produced by a block with reactive dependencies must be non-stable and reactive) - this is not true in the case of const primitives, but an overestimate is safe - whether the **scope that declares this identifier** is ~~currently active~~ the same scope in which it is used (fixed by #1275) (since a scope cannot be dependent on itself) These conditions are complex. We end up inferring most identifiers as `mutable` and `object` types, which have different stability and aliasing properties from primitives. As a result, we're missing some cases in our existing test coverage. Test case output is fixed by #1274 and #1275 --- (This can be separated from the stack below, which implements conditional dependencies. Happy to merge that first and open this as a new stack if that produces a significantly better Git PR history.)
Languages
JavaScript
67.1%
TypeScript
29.4%
HTML
1.5%
CSS
1.1%
C++
0.6%
Other
0.2%