dillon1000/react

Commit

🌲 Create scopes for primitive operations

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.
Browse files
Changed paths3 files
First-parent comparison
M compiler/packages/babel-plugin-react-forget/src/Entrypoint/Pipeline.ts ModifiedM compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/InferReactiveScopeVariables.ts ModifiedM compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/PruneNonEscapingScopes.ts Modified
Patch

Files changed

Rendering syntax-highlighted changes…