diff --git a/compiler/forget/src/__tests__/fixtures/compiler/_bug.lambda-mutated-non-reactive-to-reactive.expect.md b/compiler/forget/src/__tests__/fixtures/compiler/_bug.lambda-mutated-non-reactive-to-reactive.expect.md new file mode 100644 index 0000000000..a8f955e955 --- /dev/null +++ b/compiler/forget/src/__tests__/fixtures/compiler/_bug.lambda-mutated-non-reactive-to-reactive.expect.md @@ -0,0 +1,43 @@ + +## Input + +```javascript +function f(a) { + let x; + (() => { + x = { a }; + })(); + return
; +} + +``` + +## Code + +```javascript +import { unstable_useMemoCache as useMemoCache } from "react"; +function f(a) { + const $ = useMemoCache(3); + const c_0 = $[0] !== a; + let x; + if (c_0) { + (() => { + x = { a }; + })(); + $[0] = a; + $[1] = x; + } else { + x = $[1]; + } + let t0; + if ($[2] === Symbol.for("react.memo_cache_sentinel")) { + t0 =
; + $[2] = t0; + } else { + t0 = $[2]; + } + return t0; +} + +``` + \ No newline at end of file diff --git a/compiler/forget/src/__tests__/fixtures/compiler/_bug.lambda-mutated-non-reactive-to-reactive.js b/compiler/forget/src/__tests__/fixtures/compiler/_bug.lambda-mutated-non-reactive-to-reactive.js new file mode 100644 index 0000000000..85c905ea13 --- /dev/null +++ b/compiler/forget/src/__tests__/fixtures/compiler/_bug.lambda-mutated-non-reactive-to-reactive.js @@ -0,0 +1,7 @@ +function f(a) { + let x; + (() => { + x = { a }; + })(); + return
; +}