1
+
2
+## Input
3
+
4
+```javascript
5
+// @enablePreserveExistingMemoizationGuarantees @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enableTreatFunctionDepsAsConditional:false
6
+
7
+import {useMemo} from 'react';
8
+import {identity, ValidateMemoization} from 'shared-runtime';
9
+
10
+function Component({x, y, z}) {
11
+ const object = useMemo(() => {
12
+ return identity({
13
+ callback: () => {
14
+ return identity(x?.y?.z, y.a?.b, z.a.b?.c);
15
+ },
16
+ });
17
+ }, [x?.y?.z, y.a?.b, z.a.b?.c]);
18
+ const result = useMemo(() => {
19
+ return [object.callback()];
20
+ }, [object]);
21
+ return <Inner x={x} result={result} />;
22
+}
23
+
24
+function Inner({x, result}) {
25
+ 'use no memo';
26
+ return <ValidateMemoization inputs={[x.y.z]} output={result} />;
27
+}
28
+
29
+export const FIXTURE_ENTRYPOINT = {
30
+ fn: Component,
31
+ params: [{x: {y: {z: 42}}}],
32
+ sequentialRenders: [
33
+ {x: {y: {z: 42}}},
34
+ {x: {y: {z: 42}}},
35
+ {x: {y: {z: 3.14}}},
36
+ {x: {y: {z: 42}}},
37
+ {x: {y: {z: 3.14}}},
38
+ {x: {y: {z: 42}}},
39
+ ],
40
+};
41
+
42
+```
43
+
44
+## Code
45
+
46
+```javascript
47
+import { c as _c } from "react/compiler-runtime"; // @enablePreserveExistingMemoizationGuarantees @validatePreserveExistingMemoizationGuarantees @enableOptionalDependencies @enableTreatFunctionDepsAsConditional:false
48
+
49
+import { useMemo } from "react";
50
+import { identity, ValidateMemoization } from "shared-runtime";
51
+
52
+function Component(t0) {
53
+ const $ = _c(11);
54
+ const { x, y, z } = t0;
55
+
56
+ x?.y?.z;
57
+ y.a?.b;
58
+ z.a.b?.c;
59
+ let t1;
60
+ if ($[0] !== x?.y?.z || $[1] !== y.a?.b || $[2] !== z.a.b?.c) {
61
+ t1 = identity({ callback: () => identity(x?.y?.z, y.a?.b, z.a.b?.c) });
62
+ $[0] = x?.y?.z;
63
+ $[1] = y.a?.b;
64
+ $[2] = z.a.b?.c;
65
+ $[3] = t1;
66
+ } else {
67
+ t1 = $[3];
68
+ }
69
+ const object = t1;
70
+ let t2;
71
+ if ($[4] !== object) {
72
+ t2 = object.callback();
73
+ $[4] = object;
74
+ $[5] = t2;
75
+ } else {
76
+ t2 = $[5];
77
+ }
78
+ let t3;
79
+ if ($[6] !== t2) {
80
+ t3 = [t2];
81
+ $[6] = t2;
82
+ $[7] = t3;
83
+ } else {
84
+ t3 = $[7];
85
+ }
86
+ const result = t3;
87
+ let t4;
88
+ if ($[8] !== result || $[9] !== x) {
89
+ t4 = <Inner x={x} result={result} />;
90
+ $[8] = result;
91
+ $[9] = x;
92
+ $[10] = t4;
93
+ } else {
94
+ t4 = $[10];
95
+ }
96
+ return t4;
97
+}
98
+
99
+function Inner({ x, result }) {
100
+ "use no memo";
101
+ return <ValidateMemoization inputs={[x.y.z]} output={result} />;
102
+}
103
+
104
+export const FIXTURE_ENTRYPOINT = {
105
+ fn: Component,
106
+ params: [{ x: { y: { z: 42 } } }],
107
+ sequentialRenders: [
108
+ { x: { y: { z: 42 } } },
109
+ { x: { y: { z: 42 } } },
110
+ { x: { y: { z: 3.14 } } },
111
+ { x: { y: { z: 42 } } },
112
+ { x: { y: { z: 3.14 } } },
113
+ { x: { y: { z: 42 } } },
114
+ ],
115
+};
116
+
117
+```
118
+
119
+### Eval output
120
+(kind: ok) [[ (exception in render) TypeError: Cannot read properties of undefined (reading 'a') ]]
121
+[[ (exception in render) TypeError: Cannot read properties of undefined (reading 'a') ]]
122
+[[ (exception in render) TypeError: Cannot read properties of undefined (reading 'a') ]]
123
+[[ (exception in render) TypeError: Cannot read properties of undefined (reading 'a') ]]
124
+[[ (exception in render) TypeError: Cannot read properties of undefined (reading 'a') ]]
125
+[[ (exception in render) TypeError: Cannot read properties of undefined (reading 'a') ]]
\ No newline at end of file