dillon1000/react
Commit
Browse files 🌲 Separate pass for lowering reactive scopes
For Forest, we previously converted reactive scopes into derived signals during Codegen. I'm moving this to a separate pass primarily to keep codegen simple since there's enough complexity just dealing with core JS semantics. Ideally we'd do a similar setup even for regular Forget, ie lower reactive scopes just prior to codegen. At the same time i also reordered the forget passes to be just before codegen, and cleaned things up a bit. For state lowering, we now just rewrite `useState` -> `createState`, because we actually need to keep around the setter function to trigger scheduling updates in addition to writing the signal value.
Changed paths3 files
First-parent comparisoncompiler/packages/babel-plugin-react-forget/src/Entrypoint/Pipeline.ts ModifiedM compiler/packages/babel-plugin-react-forget/src/ReactiveScopes/CodegenReactiveFunction.ts ModifiedM compiler/packages/snap/src/compiler-worker.ts ModifiedPatch
Files changed
Rendering syntax-highlighted changes…