1
-
2
-## Input
3
-
4
-```javascript
5
-import invariant from "invariant";
6
-import {
7
- makeObject_Primitives,
8
- mutate,
9
- sum,
10
- useIdentity,
11
-} from "shared-runtime";
12
-
13
-/**
14
- * Exposes fundamental issue with pruning 'non-reactive' dependencies + flattening
15
- * those scopes. Here, `z`'s original memo block is removed due to the inner hook call.
16
- * However, we also infer that `z` is non-reactive and does not need to be a memo
17
- * dependency.
18
- *
19
- * Current evaluator error:
20
- * Found differences in evaluator results
21
- * Non-forget (expected):
22
- * (kind: ok) [4,{"a":0,"b":"value1","c":true,"wat0":"joe"}]
23
- * [4,{"a":0,"b":"value1","c":true,"wat0":"joe"}]
24
- * [5,{"a":0,"b":"value1","c":true,"wat0":"joe"}]
25
- * Forget:
26
- * (kind: ok) [4,{"a":0,"b":"value1","c":true,"wat0":"joe"}]
27
- * [[ (exception in render) Invariant Violation: oh no! ]]
28
- * [5,{"a":0,"b":"value1","c":true,"wat0":"joe"}]
29
- */
30
-
31
-function MyApp({ count }) {
32
- const z = makeObject_Primitives();
33
- const x = useIdentity(2);
34
- const y = sum(x, count);
35
- mutate(z);
36
- const thing = [y, z];
37
- if (thing[1] !== z) {
38
- invariant(false, "oh no!");
39
- }
40
- return thing;
41
-}
42
-
43
-export const FIXTURE_ENTRYPOINT = {
44
- fn: MyApp,
45
- params: [{ count: 2 }],
46
- sequentialRenders: [{ count: 2 }, { count: 2 }, { count: 3 }],
47
-};
48
-
49
-```
50
-
51
-## Code
52
-
53
-```javascript
54
-import { c as _c } from "react/compiler-runtime";
55
-import invariant from "invariant";
56
-import {
57
- makeObject_Primitives,
58
- mutate,
59
- sum,
60
- useIdentity,
61
-} from "shared-runtime";
62
-
63
-/**
64
- * Exposes fundamental issue with pruning 'non-reactive' dependencies + flattening
65
- * those scopes. Here, `z`'s original memo block is removed due to the inner hook call.
66
- * However, we also infer that `z` is non-reactive and does not need to be a memo
67
- * dependency.
68
- *
69
- * Current evaluator error:
70
- * Found differences in evaluator results
71
- * Non-forget (expected):
72
- * (kind: ok) [4,{"a":0,"b":"value1","c":true,"wat0":"joe"}]
73
- * [4,{"a":0,"b":"value1","c":true,"wat0":"joe"}]
74
- * [5,{"a":0,"b":"value1","c":true,"wat0":"joe"}]
75
- * Forget:
76
- * (kind: ok) [4,{"a":0,"b":"value1","c":true,"wat0":"joe"}]
77
- * [[ (exception in render) Invariant Violation: oh no! ]]
78
- * [5,{"a":0,"b":"value1","c":true,"wat0":"joe"}]
79
- */
80
-
81
-function MyApp(t0) {
82
- const $ = _c(5);
83
- const { count } = t0;
84
- const z = makeObject_Primitives();
85
- const x = useIdentity(2);
86
- let t1;
87
- if ($[0] !== x || $[1] !== count) {
88
- t1 = sum(x, count);
89
- $[0] = x;
90
- $[1] = count;
91
- $[2] = t1;
92
- } else {
93
- t1 = $[2];
94
- }
95
- const y = t1;
96
- mutate(z);
97
- let t2;
98
- if ($[3] !== y) {
99
- t2 = [y, z];
100
- $[3] = y;
101
- $[4] = t2;
102
- } else {
103
- t2 = $[4];
104
- }
105
- const thing = t2;
106
- if (thing[1] !== z) {
107
- invariant(false, "oh no!");
108
- }
109
- return thing;
110
-}
111
-
112
-export const FIXTURE_ENTRYPOINT = {
113
- fn: MyApp,
114
- params: [{ count: 2 }],
115
- sequentialRenders: [{ count: 2 }, { count: 2 }, { count: 3 }],
116
-};
117
-
118
-```
119
-
\ No newline at end of file