1
+
2
+## Input
3
+
4
+```javascript
5
+import {useMemo} from 'react';
6
+import {
7
+ makeObject_Primitives,
8
+ mutate,
9
+ Stringify,
10
+ ValidateMemoization,
11
+} from 'shared-runtime';
12
+
13
+function Component({cond}) {
14
+ const memoized = useMemo(() => {
15
+ const value = makeObject_Primitives();
16
+ if (cond) {
17
+ return value;
18
+ } else {
19
+ mutate(value);
20
+ return value;
21
+ }
22
+ }, [cond]);
23
+ return <ValidateMemoization inputs={[cond]} output={memoized} />;
24
+}
25
+
26
+export const FIXTURE_ENTRYPOINT = {
27
+ fn: Component,
28
+ params: [{cond: false}],
29
+ sequentialRenders: [
30
+ {cond: false},
31
+ {cond: false},
32
+ {cond: true},
33
+ {cond: true},
34
+ {cond: false},
35
+ {cond: true},
36
+ {cond: false},
37
+ {cond: true},
38
+ ],
39
+};
40
+
41
+```
42
+
43
+## Code
44
+
45
+```javascript
46
+import { c as _c } from "react/compiler-runtime";
47
+import { useMemo } from "react";
48
+import {
49
+ makeObject_Primitives,
50
+ mutate,
51
+ Stringify,
52
+ ValidateMemoization,
53
+} from "shared-runtime";
54
+
55
+function Component(t0) {
56
+ const $ = _c(7);
57
+ const { cond } = t0;
58
+ let t1;
59
+ if ($[0] !== cond) {
60
+ const value = makeObject_Primitives();
61
+ if (cond) {
62
+ t1 = value;
63
+ } else {
64
+ mutate(value);
65
+ t1 = value;
66
+ }
67
+ $[0] = cond;
68
+ $[1] = t1;
69
+ } else {
70
+ t1 = $[1];
71
+ }
72
+ const memoized = t1;
73
+ let t2;
74
+ if ($[2] !== cond) {
75
+ t2 = [cond];
76
+ $[2] = cond;
77
+ $[3] = t2;
78
+ } else {
79
+ t2 = $[3];
80
+ }
81
+ let t3;
82
+ if ($[4] !== memoized || $[5] !== t2) {
83
+ t3 = <ValidateMemoization inputs={t2} output={memoized} />;
84
+ $[4] = memoized;
85
+ $[5] = t2;
86
+ $[6] = t3;
87
+ } else {
88
+ t3 = $[6];
89
+ }
90
+ return t3;
91
+}
92
+
93
+export const FIXTURE_ENTRYPOINT = {
94
+ fn: Component,
95
+ params: [{ cond: false }],
96
+ sequentialRenders: [
97
+ { cond: false },
98
+ { cond: false },
99
+ { cond: true },
100
+ { cond: true },
101
+ { cond: false },
102
+ { cond: true },
103
+ { cond: false },
104
+ { cond: true },
105
+ ],
106
+};
107
+
108
+```
109
+
110
+### Eval output
111
+(kind: ok) <div>{"inputs":[false],"output":{"a":0,"b":"value1","c":true,"wat0":"joe"}}</div>
112
+<div>{"inputs":[false],"output":{"a":0,"b":"value1","c":true,"wat0":"joe"}}</div>
113
+<div>{"inputs":[true],"output":{"a":0,"b":"value1","c":true}}</div>
114
+<div>{"inputs":[true],"output":{"a":0,"b":"value1","c":true}}</div>
115
+<div>{"inputs":[false],"output":{"a":0,"b":"value1","c":true,"wat0":"joe"}}</div>
116
+<div>{"inputs":[true],"output":{"a":0,"b":"value1","c":true}}</div>
117
+<div>{"inputs":[false],"output":{"a":0,"b":"value1","c":true,"wat0":"joe"}}</div>
118
+<div>{"inputs":[true],"output":{"a":0,"b":"value1","c":true}}</div>
\ No newline at end of file