51
## Error
52
53
```
54
-Found 6 errors:
54
+Found 4 errors:
55
56
Error: Found missing/extra memoization dependencies
57
157
40 | }, []);
158
159
Inferred dependencies: `[ref]`
160
-
161
-Compilation Skipped: Existing memoization could not be preserved
162
-
163
-React Compiler has skipped optimizing this component because the existing manual memoization could not be preserved. The inferred dependencies did not match the manually specified dependencies, which could cause the value to change more or less frequently than expected. The inferred dependency was `x.y.z.a.b`, but the source dependencies were [x?.y.z.a?.b.z]. Inferred different dependency than source.
164
-
165
-error.invalid-exhaustive-deps.ts:14:20
166
- 12 | // ok, not our job to type check nullability
167
- 13 | }, [x.y.z.a]);
168
-> 14 | const c = useMemo(() => {
169
- | ^^^^^^^
170
-> 15 | return x?.y.z.a?.b;
171
- | ^^^^^^^^^^^^^^^^^^^^^^^
172
-> 16 | // error: too precise
173
- | ^^^^^^^^^^^^^^^^^^^^^^^
174
-> 17 | }, [x?.y.z.a?.b.z]);
175
- | ^^^^ Could not preserve existing manual memoization
176
- 18 | const d = useMemo(() => {
177
- 19 | return x?.y?.[(console.log(y), z?.b)];
178
- 20 | // ok
179
-
180
-Compilation Skipped: Existing memoization could not be preserved
181
-
182
-React Compiler has skipped optimizing this component because the existing manual memoization could not be preserved. The inferred dependencies did not match the manually specified dependencies, which could cause the value to change more or less frequently than expected. The inferred dependency was `ref`, but the source dependencies were []. Inferred dependency not present in source.
183
-
184
-error.invalid-exhaustive-deps.ts:35:21
185
- 33 | const ref2 = useRef(null);
186
- 34 | const ref = z ? ref1 : ref2;
187
-> 35 | const cb = useMemo(() => {
188
- | ^^^^^^^
189
-> 36 | return () => {
190
- | ^^^^^^^^^^^^^^^^^^
191
-> 37 | return ref.current;
192
- | ^^^^^^^^^^^^^^^^^^
193
-> 38 | };
194
- | ^^^^^^^^^^^^^^^^^^
195
-> 39 | // error: ref is a stable type but reactive
196
- | ^^^^^^^^^^^^^^^^^^
197
-> 40 | }, []);
198
- | ^^^^ Could not preserve existing manual memoization
199
- 41 | return <Stringify results={[a, b, c, d, e, f, cb]} />;
200
- 42 | }
201
- 43 |
160
```
161
162
\ No newline at end of file