dillon1000/react

Commit

Repro for unmemoized array due to mutation surrounding hook

Distilled repro of an internal example we found. Forget determines a mutable 
range for the array, but that mutable range spans a hook call, so the reactive 
scope gets pruned. That's all working as expected. 

What isn't ideal though is that if we know `x` is an array and `f` can't mutate 
its arguments, then `x.map(f)` shouldn't count as a mutation of `x`, since 
Array.prototype.map can only mutate the receiver via the callback (if the 
callback mutates its args). 

Improving on this example requires a) we have to know it's an Array, via type 
information or bc we saw an array literal and b) being precise about which 
functions could possibly mutate their parameters, which is tricky because of 
indirect mutations via stores, etc.
Browse files
Changed paths3 files
First-parent comparison
M compiler/packages/babel-plugin-react-forget/src/HIR/PrintHIR.ts ModifiedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/repro-missing-memoization-unmodified-array.expect.md AddedA compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/repro-missing-memoization-unmodified-array.js Added
Patch

Files changed

Rendering syntax-highlighted changes…