mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
9be2efdc57
In normal React certain operations don't allocate new objects (property loads, binary expressions, etc) and therefore don't need a reactive scope in Forget. For example, property loads only extract part of an existing value and don't allocate something new, while binary expressions are known to produce primitive values that don't allocate. We rely on the fact that whenever their inputs change we will re-run the component/hook and propagate the result forward. For Forest, the only way to propagate data is via reactive scopes: the component code is equivalent to a "setup" function. This PR updates some of our passes to ensure that we create (and don't prune) scopes for these types of operations. I started with a conservative set for now.