@samitouri / QOS-React / commits / a6769df6b1

[babel] Alias unstable_useMemoCache to useMemoCache

DevTools relies on built-in hook names at their call site to be unprefixed in order to correctly track them. This PR updates our Babel plugin to: - Check if there are any existing import declarations of `import { /* ... /* } from 'react';` - If true, we add the specifier `unstable_useMemoCache as useMemoCache` - Otherwise, we synthesize a new import declaration - In Codegen we now emit `useMemoCache(n)` rather than `React.unstable_useMemoCache(n)`

Lauren Tan committed Apr 26, 2023 at 13:40 UTC a6769df6b11291d5c582a8f5783fcc7f2c61e9bb
284 files changed +747 -626
compiler/forget/src/Babel/BabelPlugin.ts
+51 -23
@@ -214,48 +214,76 @@ export default function ReactForgetBabelPlugin(
214 opts: { ...pass.opts, ...options },
215 });
216
217 - // If there isn't already an import of * as React, insert it so React.useMemoCache doesn't
217 + // If there isn't already an import of * as React, insert it so useMemoCache doesn't
218 // throw
219 if (hasForgetCompiledCode) {
220 let didInsertUseMemoCache = false;
221 let hasExistingReactImport = false;
222 path.traverse({
223 - MemberExpression(memberExprPath) {
224 - const obj = memberExprPath.get("object");
225 - const prop = memberExprPath.get("property");
223 + CallExpression(callExprPath) {
224 + const callee = callExprPath.get("callee");
225 + const args = callExprPath.get("arguments");
226 if (
227 - obj.isIdentifier() &&
228 - obj.node.name === "React" &&
229 - prop.isIdentifier() &&
230 - prop.node.name === "unstable_useMemoCache"
227 + callee.isIdentifier() &&
228 + callee.node.name === "useMemoCache" &&
229 + args.length === 1 &&
230 + args[0].isNumericLiteral()
231 ) {
232 didInsertUseMemoCache = true;
233 - memberExprPath.stop();
233 }
234 },
235 ImportDeclaration(importDeclPath) {
236 + // Matches `import { /* ... */ } from 'react';`
237 + // but not `import * as React from 'react';`
238 if (
239 importDeclPath.get("source").node.value === "react" &&
239 - importDeclPath.get("specifiers").length === 1 &&
240 importDeclPath
241 - .get("specifiers")[0]
242 - .isImportNamespaceSpecifier() &&
243 - importDeclPath.get("specifiers")[0].get("local").node.name ===
244 - "React"
241 + .get("specifiers")
242 + .every((specifier) => specifier.isImportSpecifier())
243 ) {
244 hasExistingReactImport = true;
247 - importDeclPath.stop();
245 }
246 },
247 });
251 - if (didInsertUseMemoCache && !hasExistingReactImport) {
252 - path.unshiftContainer(
253 - "body",
254 - t.importDeclaration(
255 - [t.importNamespaceSpecifier(t.identifier("React"))],
256 - t.stringLiteral("react")
257 - )
258 - );
248 + // If Forget did successfully compile inject/update an import of
249 + // `import {unstable_useMemoCache as useMemoCache} from 'react'` and rename
250 + // `React.unstable_useMemoCache(n)` to `useMemoCache(n)`;
251 + if (didInsertUseMemoCache) {
252 + if (hasExistingReactImport) {
253 + let didUpdateImport = false;
254 + path.traverse({
255 + ImportDeclaration(importDeclPath) {
256 + if (importDeclPath.get("source").node.value === "react") {
257 + importDeclPath.pushContainer(
258 + "specifiers",
259 + t.importSpecifier(
260 + t.identifier("useMemoCache"),
261 + t.identifier("unstable_useMemoCache")
262 + )
263 + );
264 + didUpdateImport = true;
265 + }
266 + },
267 + });
268 + if (didUpdateImport === false) {
269 + throw new Error(
270 + "Expected an ImportDeclaration of react in order to update ImportSpecifiers with useMemoCache"
271 + );
272 + }
273 + } else {
274 + path.unshiftContainer(
275 + "body",
276 + t.importDeclaration(
277 + [
278 + t.importSpecifier(
279 + t.identifier("useMemoCache"),
280 + t.identifier("unstable_useMemoCache")
281 + ),
282 + ],
283 + t.stringLiteral("react")
284 + )
285 + );
286 + }
287 }
288 if (options.gating != null) {
289 path.unshiftContainer(
compiler/forget/src/ReactiveScopes/CodegenReactiveFunction.ts
+4 -7
@@ -54,17 +54,14 @@ export function codegenReactiveFunction(
54 }
55 const cacheCount = cx.nextCacheIndex;
56 if (cacheCount !== 0) {
57 + // The import declaration for `useMemoCache` is inserted in the Babel plugin
58 statements.unshift(
59 t.variableDeclaration("const", [
60 t.variableDeclarator(
61 t.identifier("$"),
61 - t.callExpression(
62 - t.memberExpression(
63 - t.identifier("React"),
64 - t.identifier("unstable_useMemoCache")
65 - ),
66 - [t.numericLiteral(cacheCount)]
67 - )
62 + t.callExpression(t.identifier("useMemoCache"), [
63 + t.numericLiteral(cacheCount),
64 + ])
65 ),
66 ])
67 );
compiler/forget/src/__tests__/fixtures/compiler/_bug.computed-call-evaluation-order.expect.md
+2 -2
@@ -23,13 +23,13 @@ function Component() {
23 ## Code
24
25 ```javascript
26 -import * as React from "react"; // Should print A, B, arg, original
26 +import { unstable_useMemoCache as useMemoCache } from "react"; // Should print A, B, arg, original
27 function changeF(o) {
28 o.f = () => console.log("new");
29 }
30
31 function Component() {
32 - const $ = React.unstable_useMemoCache(2);
32 + const $ = useMemoCache(2);
33 let t0;
34 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
35 t0 = () => console.log("original");
compiler/forget/src/__tests__/fixtures/compiler/_bug.global-jsx-tag-lowered-between-mutations.expect.md
+2 -2
@@ -23,9 +23,9 @@ function Component(props) {
23 ## Code
24
25 ```javascript
26 -import * as React from "react";
26 +import { unstable_useMemoCache as useMemoCache } from "react";
27 function Component(props) {
28 - const $ = React.unstable_useMemoCache(3);
28 + const $ = useMemoCache(3);
29 let t0;
30 let t1;
31 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
compiler/forget/src/__tests__/fixtures/compiler/_bug.lambda-reassign-shadowed-primitive.expect.md
+2 -2
@@ -19,9 +19,9 @@ function Component() {
19 ## Code
20
21 ```javascript
22 -import * as React from "react";
22 +import { unstable_useMemoCache as useMemoCache } from "react";
23 function Component() {
24 - const $ = React.unstable_useMemoCache(1);
24 + const $ = useMemoCache(1);
25 let t0;
26 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
27 t0 = {};
compiler/forget/src/__tests__/fixtures/compiler/_bug.property-call-evaluation-order.expect.md
+2 -2
@@ -22,14 +22,14 @@ function Component() {
22 ## Code
23
24 ```javascript
25 -import * as React from "react"; // Should print A, arg, original
25 +import { unstable_useMemoCache as useMemoCache } from "react"; // Should print A, arg, original
26
27 function changeF(o) {
28 o.f = () => console.log("new");
29 }
30
31 function Component() {
32 - const $ = React.unstable_useMemoCache(2);
32 + const $ = useMemoCache(2);
33 let t0;
34 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
35 t0 = () => console.log("original");
compiler/forget/src/__tests__/fixtures/compiler/alias-computed-load.expect.md
+2 -2
@@ -16,9 +16,9 @@ function component(a) {
16 ## Code
17
18 ```javascript
19 -import * as React from "react";
19 +import { unstable_useMemoCache as useMemoCache } from "react";
20 function component(a) {
21 - const $ = React.unstable_useMemoCache(2);
21 + const $ = useMemoCache(2);
22 const c_0 = $[0] !== a;
23 let x;
24 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/alias-nested-member-path-mutate.expect.md
+2 -2
@@ -17,9 +17,9 @@ function component() {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 function component() {
22 - const $ = React.unstable_useMemoCache(1);
22 + const $ = useMemoCache(1);
23 let x;
24 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
25 const z = [];
compiler/forget/src/__tests__/fixtures/compiler/alias-nested-member-path.expect.md
+2 -2
@@ -16,9 +16,9 @@ function component() {
16 ## Code
17
18 ```javascript
19 -import * as React from "react";
19 +import { unstable_useMemoCache as useMemoCache } from "react";
20 function component() {
21 - const $ = React.unstable_useMemoCache(3);
21 + const $ = useMemoCache(3);
22 let t0;
23 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
24 t0 = [];
compiler/forget/src/__tests__/fixtures/compiler/alias-while.expect.md
+2 -2
@@ -26,9 +26,9 @@ function mutate(x, y) {}
26 ## Code
27
28 ```javascript
29 -import * as React from "react";
29 +import { unstable_useMemoCache as useMemoCache } from "react";
30 function foo(cond) {
31 - const $ = React.unstable_useMemoCache(2);
31 + const $ = useMemoCache(2);
32 const c_0 = $[0] !== cond;
33 let a;
34 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/allocating-primitive-as-dep-nested-scope.expect.md
+2 -2
@@ -19,12 +19,12 @@ function AllocatingPrimitiveAsDepNested(props) {
19 ## Code
20
21 ```javascript
22 -import * as React from "react"; // bar(props.b) is an allocating expression that produces a primitive, which means
22 +import { unstable_useMemoCache as useMemoCache } from "react"; // bar(props.b) is an allocating expression that produces a primitive, which means
23 // that Forget should memoize it.
24 // Correctness:
25 // - y depends on either bar(props.b) or bar(props.b) + 1
26 function AllocatingPrimitiveAsDepNested(props) {
27 - const $ = React.unstable_useMemoCache(9);
27 + const $ = useMemoCache(9);
28 const c_0 = $[0] !== props.b;
29 const c_1 = $[1] !== props.a;
30 let x;
compiler/forget/src/__tests__/fixtures/compiler/allocating-primitive-as-dep.expect.md
+2 -2
@@ -16,12 +16,12 @@ function AllocatingPrimitiveAsDep(props) {
16 ## Code
17
18 ```javascript
19 -import * as React from "react"; // bar(props.b) is an allocating expression that produces a primitive, which means
19 +import { unstable_useMemoCache as useMemoCache } from "react"; // bar(props.b) is an allocating expression that produces a primitive, which means
20 // that Forget should memoize it.
21 // Correctness:
22 // - y depends on either bar(props.b) or bar(props.b) + 1
23 function AllocatingPrimitiveAsDep(props) {
24 - const $ = React.unstable_useMemoCache(2);
24 + const $ = useMemoCache(2);
25 const t0 = bar(props).b + 1;
26 const c_0 = $[0] !== t0;
27 let t1;
compiler/forget/src/__tests__/fixtures/compiler/array-access-assignment.expect.md
+2 -2
@@ -16,9 +16,9 @@ function foo(a, b, c) {
16 ## Code
17
18 ```javascript
19 -import * as React from "react";
19 +import { unstable_useMemoCache as useMemoCache } from "react";
20 function foo(a, b, c) {
21 - const $ = React.unstable_useMemoCache(10);
21 + const $ = useMemoCache(10);
22 const c_0 = $[0] !== a;
23 const c_1 = $[1] !== b;
24 const c_2 = $[2] !== c;
compiler/forget/src/__tests__/fixtures/compiler/array-at-closure.expect.md
+2 -2
@@ -17,9 +17,9 @@ function Component(props) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 function Component(props) {
22 - const $ = React.unstable_useMemoCache(7);
22 + const $ = useMemoCache(7);
23 const c_0 = $[0] !== props.x;
24 let t0;
25 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/array-at-effect.expect.md
+2 -2
@@ -17,12 +17,12 @@ function ArrayAtTest(props) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react"; // arrayInstance.at should have the following effects:
20 +import { unstable_useMemoCache as useMemoCache } from "react"; // arrayInstance.at should have the following effects:
21 // - read on arg0
22 // - read on receiver
23 // - mutate on lvalue
24 function ArrayAtTest(props) {
25 - const $ = React.unstable_useMemoCache(9);
25 + const $ = useMemoCache(9);
26 const c_0 = $[0] !== props.x;
27 let t0;
28 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/array-at-mutate-after-capture.expect.md
+2 -2
@@ -18,10 +18,10 @@ function Component(props) {
18 ## Code
19
20 ```javascript
21 -import * as React from "react"; // x's mutable range should extend to `mutate(y)`
21 +import { unstable_useMemoCache as useMemoCache } from "react"; // x's mutable range should extend to `mutate(y)`
22
23 function Component(props) {
24 - const $ = React.unstable_useMemoCache(2);
24 + const $ = useMemoCache(2);
25 let t0;
26 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
27 t0 = {};
compiler/forget/src/__tests__/fixtures/compiler/array-expression-spread.expect.md
+2 -2
@@ -12,9 +12,9 @@ function Component(props) {
12 ## Code
13
14 ```javascript
15 -import * as React from "react";
15 +import { unstable_useMemoCache as useMemoCache } from "react";
16 function Component(props) {
17 - const $ = React.unstable_useMemoCache(3);
17 + const $ = useMemoCache(3);
18 const c_0 = $[0] !== props.foo;
19 const c_1 = $[1] !== props.bar;
20 let t0;
compiler/forget/src/__tests__/fixtures/compiler/array-pattern-params.expect.md
+2 -2
@@ -13,9 +13,9 @@ function component([a, b]) {
13 ## Code
14
15 ```javascript
16 -import * as React from "react";
16 +import { unstable_useMemoCache as useMemoCache } from "react";
17 function component(t17) {
18 - const $ = React.unstable_useMemoCache(7);
18 + const $ = useMemoCache(7);
19 const [a, b] = t17;
20 const c_0 = $[0] !== a;
21 let t0;
compiler/forget/src/__tests__/fixtures/compiler/array-properties.expect.md
+2 -2
@@ -14,9 +14,9 @@ function Component(props) {
14 ## Code
15
16 ```javascript
17 -import * as React from "react";
17 +import { unstable_useMemoCache as useMemoCache } from "react";
18 function Component(props) {
19 - const $ = React.unstable_useMemoCache(7);
19 + const $ = useMemoCache(7);
20 const c_0 = $[0] !== props.a;
21 const c_1 = $[1] !== props.b;
22 let t0;
compiler/forget/src/__tests__/fixtures/compiler/array-property-call.expect.md
+2 -2
@@ -15,9 +15,9 @@ function Component(props) {
15 ## Code
16
17 ```javascript
18 -import * as React from "react";
18 +import { unstable_useMemoCache as useMemoCache } from "react";
19 function Component(props) {
20 - const $ = React.unstable_useMemoCache(11);
20 + const $ = useMemoCache(11);
21 const c_0 = $[0] !== props.a;
22 const c_1 = $[1] !== props.b;
23 let t0;
compiler/forget/src/__tests__/fixtures/compiler/array-push-effect.expect.md
+2 -2
@@ -19,11 +19,11 @@ function Component(props) {
19 ## Code
20
21 ```javascript
22 -import * as React from "react"; // arrayInstance.push should have the following effects:
22 +import { unstable_useMemoCache as useMemoCache } from "react"; // arrayInstance.push should have the following effects:
23 // - read on all args (rest parameter)
24 // - mutate on receiver
25 function Component(props) {
26 - const $ = React.unstable_useMemoCache(8);
26 + const $ = useMemoCache(8);
27 const c_0 = $[0] !== props.x;
28 let t0;
29 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/arrow-function-expr-gating-test.expect.md
+2 -2
@@ -13,12 +13,12 @@ export default ErrorView;
13
14 ```javascript
15 import { isForgetEnabled_Fixtures } from "ReactForgetFeatureFlag";
16 -import * as React from "react"; // @gating
16 +import { unstable_useMemoCache as useMemoCache } from "react"; // @gating
17 function ErrorView_uncompiled(error, _retry) {
18 return <MessageBox error={error}></MessageBox>;
19 }
20 function ErrorView_forget(error, _retry) {
21 - const $ = React.unstable_useMemoCache(2);
21 + const $ = useMemoCache(2);
22 const c_0 = $[0] !== error;
23 let t0;
24 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/assignment-expression-computed.expect.md
+2 -2
@@ -15,9 +15,9 @@ function Component(props) {
15 ## Code
16
17 ```javascript
18 -import * as React from "react";
18 +import { unstable_useMemoCache as useMemoCache } from "react";
19 function Component(props) {
20 - const $ = React.unstable_useMemoCache(2);
20 + const $ = useMemoCache(2);
21 const c_0 = $[0] !== props.x;
22 let x;
23 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/assignment-expression-nested-path.expect.md
+2 -2
@@ -14,9 +14,9 @@ function g(props) {
14 ## Code
15
16 ```javascript
17 -import * as React from "react";
17 +import { unstable_useMemoCache as useMemoCache } from "react";
18 function g(props) {
19 - const $ = React.unstable_useMemoCache(2);
19 + const $ = useMemoCache(2);
20 const c_0 = $[0] !== props.c;
21 let a;
22 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/assignment-in-nested-if.expect.md
+2 -2
@@ -19,9 +19,9 @@ function useBar(props) {
19 ## Code
20
21 ```javascript
22 -import * as React from "react";
22 +import { unstable_useMemoCache as useMemoCache } from "react";
23 function useBar(props) {
24 - const $ = React.unstable_useMemoCache(1);
24 + const $ = useMemoCache(1);
25 let z;
26 if (props.a) {
27 if (props.b) {
compiler/forget/src/__tests__/fixtures/compiler/assignment-variations-complex-lvalue-array.expect.md
+2 -2
@@ -14,9 +14,9 @@ function foo() {
14 ## Code
15
16 ```javascript
17 -import * as React from "react";
17 +import { unstable_useMemoCache as useMemoCache } from "react";
18 function foo() {
19 - const $ = React.unstable_useMemoCache(2);
19 + const $ = useMemoCache(2);
20 let t0;
21 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
22 t0 = [1];
compiler/forget/src/__tests__/fixtures/compiler/assignment-variations-complex-lvalue.expect.md
+2 -2
@@ -14,9 +14,9 @@ function g() {
14 ## Code
15
16 ```javascript
17 -import * as React from "react";
17 +import { unstable_useMemoCache as useMemoCache } from "react";
18 function g() {
19 - const $ = React.unstable_useMemoCache(1);
19 + const $ = useMemoCache(1);
20 let x;
21 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
22 x = { y: { z: 1 } };
compiler/forget/src/__tests__/fixtures/compiler/await-side-effecting-promise.expect.md
+2 -2
@@ -13,9 +13,9 @@ async function Component(props) {
13 ## Code
14
15 ```javascript
16 -import * as React from "react";
16 +import { unstable_useMemoCache as useMemoCache } from "react";
17 async function Component(props) {
18 - const $ = React.unstable_useMemoCache(2);
18 + const $ = useMemoCache(2);
19 const c_0 = $[0] !== props.id;
20 let x;
21 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/await.expect.md
+2 -2
@@ -12,9 +12,9 @@ async function Component(props) {
12 ## Code
13
14 ```javascript
15 -import * as React from "react";
15 +import { unstable_useMemoCache as useMemoCache } from "react";
16 async function Component(props) {
17 - const $ = React.unstable_useMemoCache(4);
17 + const $ = useMemoCache(4);
18 const c_0 = $[0] !== props.id;
19 let t0;
20 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/babel-existing-react-import.expect.md
+36 -26
@@ -2,18 +2,17 @@
2 ## Input
3
4 ```javascript
5 -import * as React from "react";
6 -import { useMemo } from "react";
5 +import { useState, useMemo } from "react";
6
7 function Component(props) {
9 - const [x] = React.useState(0);
8 + const [x] = useState(0);
9 const expensiveNumber = useMemo(() => calculateExpensiveNumber(x), [x]);
10
11 return <div>{expensiveNumber}</div>;
12 }
13
14 function Component2(props) {
16 - const [x] = React.useState(0);
15 + const [x] = useState(0);
16 const expensiveNumber = useMemo(() => calculateExpensiveNumber(x), [x]);
17
18 return <div>{expensiveNumber}</div>;
@@ -24,49 +23,60 @@ function Component2(props) {
23 ## Code
24
25 ```javascript
27 -import * as React from "react";
28 -import { useMemo } from "react";
26 +import {
27 + useState,
28 + useMemo,
29 + unstable_useMemoCache as useMemoCache,
30 +} from "react";
31
32 function Component(props) {
31 - const $ = React.unstable_useMemoCache(2);
33 + const $ = useMemoCache(4);
34 + const [x] = useState(0);
35 + const c_0 = $[0] !== x;
36 let t0;
33 - if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
34 - const [x] = React.useState(0);
37 + if (c_0) {
38 t0 = calculateExpensiveNumber(x);
36 - $[0] = t0;
39 + $[0] = x;
40 + $[1] = t0;
41 } else {
38 - t0 = $[0];
42 + t0 = $[1];
43 }
40 - const t17 = t0;
41 - const expensiveNumber = t17;
44 + const t16 = t0;
45 + const expensiveNumber = t16;
46 + const c_2 = $[2] !== expensiveNumber;
47 let t1;
43 - if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
48 + if (c_2) {
49 t1 = <div>{expensiveNumber}</div>;
45 - $[1] = t1;
50 + $[2] = expensiveNumber;
51 + $[3] = t1;
52 } else {
47 - t1 = $[1];
53 + t1 = $[3];
54 }
55 return t1;
56 }
57
58 function Component2(props) {
53 - const $ = React.unstable_useMemoCache(2);
59 + const $ = useMemoCache(4);
60 + const [x] = useState(0);
61 + const c_0 = $[0] !== x;
62 let t0;
55 - if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
56 - const [x] = React.useState(0);
63 + if (c_0) {
64 t0 = calculateExpensiveNumber(x);
58 - $[0] = t0;
65 + $[0] = x;
66 + $[1] = t0;
67 } else {
60 - t0 = $[0];
68 + t0 = $[1];
69 }
62 - const t17 = t0;
63 - const expensiveNumber = t17;
70 + const t16 = t0;
71 + const expensiveNumber = t16;
72 + const c_2 = $[2] !== expensiveNumber;
73 let t1;
65 - if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
74 + if (c_2) {
75 t1 = <div>{expensiveNumber}</div>;
67 - $[1] = t1;
76 + $[2] = expensiveNumber;
77 + $[3] = t1;
78 } else {
69 - t1 = $[1];
79 + t1 = $[3];
80 }
81 return t1;
82 }
compiler/forget/src/__tests__/fixtures/compiler/babel-existing-react-import.js
+3 -4
@@ -1,15 +1,14 @@
1 -import * as React from "react";
2 -import { useMemo } from "react";
1 +import { useState, useMemo } from "react";
2
3 function Component(props) {
5 - const [x] = React.useState(0);
4 + const [x] = useState(0);
5 const expensiveNumber = useMemo(() => calculateExpensiveNumber(x), [x]);
6
7 return <div>{expensiveNumber}</div>;
8 }
9
10 function Component2(props) {
12 - const [x] = React.useState(0);
11 + const [x] = useState(0);
12 const expensiveNumber = useMemo(() => calculateExpensiveNumber(x), [x]);
13
14 return <div>{expensiveNumber}</div>;
compiler/forget/src/__tests__/fixtures/compiler/babel-existing-react-namespace-import.expect.md new
+72
@@ -0,0 +1,72 @@
1 +
2 +## Input
3 +
4 +```javascript
5 +import * as React from "react";
6 +
7 +function Component(props) {
8 + const [x] = React.useState(0);
9 + const expensiveNumber = React.useMemo(() => calculateExpensiveNumber(x), [x]);
10 +
11 + return <div>{expensiveNumber}</div>;
12 +}
13 +
14 +function Component2(props) {
15 + const [x] = React.useState(0);
16 + const expensiveNumber = React.useMemo(() => calculateExpensiveNumber(x), [x]);
17 +
18 + return <div>{expensiveNumber}</div>;
19 +}
20 +
21 +```
22 +
23 +## Code
24 +
25 +```javascript
26 +import { unstable_useMemoCache as useMemoCache } from "react";
27 +import * as React from "react";
28 +
29 +function Component(props) {
30 + const $ = useMemoCache(2);
31 + let t0;
32 + if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
33 + const [x] = React.useState(0);
34 + t0 = React.useMemo(() => calculateExpensiveNumber(x), [x]);
35 + $[0] = t0;
36 + } else {
37 + t0 = $[0];
38 + }
39 + const expensiveNumber = t0;
40 + let t1;
41 + if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
42 + t1 = <div>{expensiveNumber}</div>;
43 + $[1] = t1;
44 + } else {
45 + t1 = $[1];
46 + }
47 + return t1;
48 +}
49 +
50 +function Component2(props) {
51 + const $ = useMemoCache(2);
52 + let t0;
53 + if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
54 + const [x] = React.useState(0);
55 + t0 = React.useMemo(() => calculateExpensiveNumber(x), [x]);
56 + $[0] = t0;
57 + } else {
58 + t0 = $[0];
59 + }
60 + const expensiveNumber = t0;
61 + let t1;
62 + if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
63 + t1 = <div>{expensiveNumber}</div>;
64 + $[1] = t1;
65 + } else {
66 + t1 = $[1];
67 + }
68 + return t1;
69 +}
70 +
71 +```
72 +
\ No newline at end of file
compiler/forget/src/__tests__/fixtures/compiler/babel-existing-react-namespace-import.js new
+15
@@ -0,0 +1,15 @@
1 +import * as React from "react";
2 +
3 +function Component(props) {
4 + const [x] = React.useState(0);
5 + const expensiveNumber = React.useMemo(() => calculateExpensiveNumber(x), [x]);
6 +
7 + return <div>{expensiveNumber}</div>;
8 +}
9 +
10 +function Component2(props) {
11 + const [x] = React.useState(0);
12 + const expensiveNumber = React.useMemo(() => calculateExpensiveNumber(x), [x]);
13 +
14 + return <div>{expensiveNumber}</div>;
15 +}
compiler/forget/src/__tests__/fixtures/compiler/bug_object-pattern.expect.md
+2 -2
@@ -13,9 +13,9 @@ function component(t) {
13 ## Code
14
15 ```javascript
16 -import * as React from "react";
16 +import { unstable_useMemoCache as useMemoCache } from "react";
17 function component(t) {
18 - const $ = React.unstable_useMemoCache(2);
18 + const $ = useMemoCache(2);
19 const { a } = t;
20 const c_0 = $[0] !== a;
21 let t0;
compiler/forget/src/__tests__/fixtures/compiler/call-args-assignment.expect.md
+2 -2
@@ -13,9 +13,9 @@ function Component(props) {
13 ## Code
14
15 ```javascript
16 -import * as React from "react";
16 +import { unstable_useMemoCache as useMemoCache } from "react";
17 function Component(props) {
18 - const $ = React.unstable_useMemoCache(1);
18 + const $ = useMemoCache(1);
19 let x;
20 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
21 x = makeObject();
compiler/forget/src/__tests__/fixtures/compiler/call-args-destructuring-assignment.expect.md
+2 -2
@@ -13,9 +13,9 @@ function Component(props) {
13 ## Code
14
15 ```javascript
16 -import * as React from "react";
16 +import { unstable_useMemoCache as useMemoCache } from "react";
17 function Component(props) {
18 - const $ = React.unstable_useMemoCache(1);
18 + const $ = useMemoCache(1);
19 let x;
20 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
21 x = makeObject();
compiler/forget/src/__tests__/fixtures/compiler/call-spread.expect.md
+2 -2
@@ -12,9 +12,9 @@ function Component(props) {
12 ## Code
13
14 ```javascript
15 -import * as React from "react";
15 +import { unstable_useMemoCache as useMemoCache } from "react";
16 function Component(props) {
17 - const $ = React.unstable_useMemoCache(3);
17 + const $ = useMemoCache(3);
18 const c_0 = $[0] !== props.a;
19 const c_1 = $[1] !== props.b;
20 let t0;
compiler/forget/src/__tests__/fixtures/compiler/call-with-independently-memoizable-arg.expect.md
+2 -2
@@ -17,9 +17,9 @@ function Component(props) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 function Component(props) {
22 - const $ = React.unstable_useMemoCache(6);
22 + const $ = useMemoCache(6);
23 const c_0 = $[0] !== props;
24 let t2;
25 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/call.expect.md
+2 -2
@@ -18,11 +18,11 @@ function Component(props) {
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function foo() {}
23
24 function Component(props) {
25 - const $ = React.unstable_useMemoCache(3);
25 + const $ = useMemoCache(3);
26 let a;
27 let b;
28 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
compiler/forget/src/__tests__/fixtures/compiler/capture-func-passed-to-jsx.expect.md
+2 -2
@@ -19,9 +19,9 @@ function component(a, b) {
19 ## Code
20
21 ```javascript
22 -import * as React from "react";
22 +import { unstable_useMemoCache as useMemoCache } from "react";
23 function component(a, b) {
24 - const $ = React.unstable_useMemoCache(9);
24 + const $ = useMemoCache(9);
25 const c_0 = $[0] !== b;
26 let t0;
27 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capture-indirect-mutate-alias.expect.md
+2 -2
@@ -19,9 +19,9 @@ function component(a) {
19 ## Code
20
21 ```javascript
22 -import * as React from "react";
22 +import { unstable_useMemoCache as useMemoCache } from "react";
23 function component(a) {
24 - const $ = React.unstable_useMemoCache(2);
24 + const $ = useMemoCache(2);
25 const c_0 = $[0] !== a;
26 let x;
27 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capture-param-mutate.expect.md
+2 -2
@@ -45,9 +45,9 @@ function getNativeLogFunction(level) {
45 ## Code
46
47 ```javascript
48 -import * as React from "react";
48 +import { unstable_useMemoCache as useMemoCache } from "react";
49 function getNativeLogFunction(level) {
50 - const $ = React.unstable_useMemoCache(2);
50 + const $ = useMemoCache(2);
51 const c_0 = $[0] !== level;
52 let t0;
53 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capture_mutate-across-fns.expect.md
+2 -2
@@ -17,9 +17,9 @@ function component(a) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 function component(a) {
22 - const $ = React.unstable_useMemoCache(2);
22 + const $ = useMemoCache(2);
23 const c_0 = $[0] !== a;
24 let z;
25 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capturing-arrow-function-1.expect.md
+2 -2
@@ -15,9 +15,9 @@ function component(a) {
15 ## Code
16
17 ```javascript
18 -import * as React from "react";
18 +import { unstable_useMemoCache as useMemoCache } from "react";
19 function component(a) {
20 - const $ = React.unstable_useMemoCache(4);
20 + const $ = useMemoCache(4);
21 const c_0 = $[0] !== a;
22 let t0;
23 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-2.expect.md
+2 -2
@@ -19,9 +19,9 @@ function component(foo, bar) {
19 ## Code
20
21 ```javascript
22 -import * as React from "react";
22 +import { unstable_useMemoCache as useMemoCache } from "react";
23 function component(foo, bar) {
24 - const $ = React.unstable_useMemoCache(3);
24 + const $ = useMemoCache(3);
25 const c_0 = $[0] !== foo;
26 const c_1 = $[1] !== bar;
27 let x;
compiler/forget/src/__tests__/fixtures/compiler/capturing-fun-alias-captured-mutate-arr-2.expect.md
+2 -2
@@ -19,9 +19,9 @@ function component(foo, bar) {
19 ## Code
20
21 ```javascript
22 -import * as React from "react";
22 +import { unstable_useMemoCache as useMemoCache } from "react";
23 function component(foo, bar) {
24 - const $ = React.unstable_useMemoCache(3);
24 + const $ = useMemoCache(3);
25 const c_0 = $[0] !== foo;
26 const c_1 = $[1] !== bar;
27 let x;
compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate-arr.expect.md
+2 -2
@@ -19,9 +19,9 @@ function component(foo, bar) {
19 ## Code
20
21 ```javascript
22 -import * as React from "react";
22 +import { unstable_useMemoCache as useMemoCache } from "react";
23 function component(foo, bar) {
24 - const $ = React.unstable_useMemoCache(3);
24 + const $ = useMemoCache(3);
25 const c_0 = $[0] !== foo;
26 const c_1 = $[1] !== bar;
27 let y;
compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-captured-mutate.expect.md
+2 -2
@@ -19,9 +19,9 @@ function component(foo, bar) {
19 ## Code
20
21 ```javascript
22 -import * as React from "react";
22 +import { unstable_useMemoCache as useMemoCache } from "react";
23 function component(foo, bar) {
24 - const $ = React.unstable_useMemoCache(3);
24 + const $ = useMemoCache(3);
25 const c_0 = $[0] !== foo;
26 const c_1 = $[1] !== bar;
27 let y;
compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-computed-mutate.expect.md
+2 -2
@@ -17,9 +17,9 @@ function component(a) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 function component(a) {
22 - const $ = React.unstable_useMemoCache(2);
22 + const $ = useMemoCache(2);
23 const c_0 = $[0] !== a;
24 let y;
25 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-mutate.expect.md
+2 -2
@@ -17,9 +17,9 @@ function component(a) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 function component(a) {
22 - const $ = React.unstable_useMemoCache(2);
22 + const $ = useMemoCache(2);
23 const c_0 = $[0] !== a;
24 let y;
25 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-computed-mutate.expect.md
+2 -2
@@ -18,9 +18,9 @@ function component(a) {
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function component(a) {
23 - const $ = React.unstable_useMemoCache(2);
23 + const $ = useMemoCache(2);
24 const c_0 = $[0] !== a;
25 let y;
26 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capturing-func-alias-receiver-mutate.expect.md
+2 -2
@@ -18,9 +18,9 @@ function component(a) {
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function component(a) {
23 - const $ = React.unstable_useMemoCache(2);
23 + const $ = useMemoCache(2);
24 const c_0 = $[0] !== a;
25 let y;
26 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capturing-func-mutate-2.expect.md
+2 -2
@@ -18,9 +18,9 @@ function component(a, b) {
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function component(a, b) {
23 - const $ = React.unstable_useMemoCache(5);
23 + const $ = useMemoCache(5);
24 const c_0 = $[0] !== b;
25 let t0;
26 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capturing-func-mutate-3.expect.md
+2 -2
@@ -17,9 +17,9 @@ function component(a, b) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 function component(a, b) {
22 - const $ = React.unstable_useMemoCache(7);
22 + const $ = useMemoCache(7);
23 const c_0 = $[0] !== b;
24 let t0;
25 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capturing-func-mutate-nested.expect.md
+2 -2
@@ -16,9 +16,9 @@ function component(a) {
16 ## Code
17
18 ```javascript
19 -import * as React from "react";
19 +import { unstable_useMemoCache as useMemoCache } from "react";
20 function component(a) {
21 - const $ = React.unstable_useMemoCache(2);
21 + const $ = useMemoCache(2);
22 const c_0 = $[0] !== a;
23 let x;
24 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capturing-func-mutate.expect.md
+2 -2
@@ -18,9 +18,9 @@ function component(a, b) {
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function component(a, b) {
23 - const $ = React.unstable_useMemoCache(5);
23 + const $ = useMemoCache(5);
24 const c_0 = $[0] !== a;
25 const c_1 = $[1] !== b;
26 let x;
compiler/forget/src/__tests__/fixtures/compiler/capturing-func-simple-alias.expect.md
+2 -2
@@ -17,9 +17,9 @@ function component(a) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 function component(a) {
22 - const $ = React.unstable_useMemoCache(2);
22 + const $ = useMemoCache(2);
23 const c_0 = $[0] !== a;
24 let y;
25 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capturing-function-1.expect.md
+2 -2
@@ -15,9 +15,9 @@ function component(a) {
15 ## Code
16
17 ```javascript
18 -import * as React from "react";
18 +import { unstable_useMemoCache as useMemoCache } from "react";
19 function component(a) {
20 - const $ = React.unstable_useMemoCache(4);
20 + const $ = useMemoCache(4);
21 const c_0 = $[0] !== a;
22 let t0;
23 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-2.expect.md
+2 -2
@@ -17,9 +17,9 @@ function bar(a) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 function bar(a) {
22 - const $ = React.unstable_useMemoCache(2);
22 + const $ = useMemoCache(2);
23 const c_0 = $[0] !== a;
24 let y;
25 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-3.expect.md
+2 -2
@@ -19,9 +19,9 @@ function bar(a, b) {
19 ## Code
20
21 ```javascript
22 -import * as React from "react";
22 +import { unstable_useMemoCache as useMemoCache } from "react";
23 function bar(a, b) {
24 - const $ = React.unstable_useMemoCache(3);
24 + const $ = useMemoCache(3);
25 const c_0 = $[0] !== a;
26 const c_1 = $[1] !== b;
27 let y;
compiler/forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load-4.expect.md
+2 -2
@@ -17,9 +17,9 @@ function bar(a) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 function bar(a) {
22 - const $ = React.unstable_useMemoCache(2);
22 + const $ = useMemoCache(2);
23 const c_0 = $[0] !== a;
24 let y;
25 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capturing-function-alias-computed-load.expect.md
+2 -2
@@ -17,9 +17,9 @@ function bar(a) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 function bar(a) {
22 - const $ = React.unstable_useMemoCache(2);
22 + const $ = useMemoCache(2);
23 const c_0 = $[0] !== a;
24 let y;
25 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capturing-function-capture-ref-before-rename.expect.md
+2 -2
@@ -22,9 +22,9 @@ function component(a, b) {
22 ## Code
23
24 ```javascript
25 -import * as React from "react";
25 +import { unstable_useMemoCache as useMemoCache } from "react";
26 function component(a, b) {
27 - const $ = React.unstable_useMemoCache(7);
27 + const $ = useMemoCache(7);
28 const c_0 = $[0] !== a;
29 let z;
30 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capturing-function-conditional-capture-mutate.expect.md
+2 -2
@@ -18,9 +18,9 @@ function component(a, b) {
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function component(a, b) {
23 - const $ = React.unstable_useMemoCache(5);
23 + const $ = useMemoCache(5);
24 const c_0 = $[0] !== a;
25 let t0;
26 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capturing-function-decl.expect.md
+2 -2
@@ -16,9 +16,9 @@ function component(a) {
16 ## Code
17
18 ```javascript
19 -import * as React from "react";
19 +import { unstable_useMemoCache as useMemoCache } from "react";
20 function component(a) {
21 - const $ = React.unstable_useMemoCache(2);
21 + const $ = useMemoCache(2);
22 const c_0 = $[0] !== a;
23 let t;
24 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capturing-function-member-expr-arguments.expect.md
+2 -2
@@ -18,9 +18,9 @@ function Foo(props) {
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function Foo(props) {
23 - const $ = React.unstable_useMemoCache(2);
23 + const $ = useMemoCache(2);
24 const c_0 = $[0] !== props.router.location;
25 let t0;
26 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capturing-function-member-expr-call.expect.md
+2 -2
@@ -19,9 +19,9 @@ function component({ mutator }) {
19 ## Code
20
21 ```javascript
22 -import * as React from "react";
22 +import { unstable_useMemoCache as useMemoCache } from "react";
23 function component(t27) {
24 - const $ = React.unstable_useMemoCache(7);
24 + const $ = useMemoCache(7);
25 const { mutator } = t27;
26 const c_0 = $[0] !== mutator;
27 let t0;
compiler/forget/src/__tests__/fixtures/compiler/capturing-function-renamed-ref.expect.md
+2 -2
@@ -18,9 +18,9 @@ function component(a, b) {
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function component(a, b) {
23 - const $ = React.unstable_useMemoCache(2);
23 + const $ = useMemoCache(2);
24 const c_0 = $[0] !== a;
25 let t0;
26 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capturing-function-runs-inference.expect.md
+2 -2
@@ -13,9 +13,9 @@ function component(a, b) {
13 ## Code
14
15 ```javascript
16 -import * as React from "react";
16 +import { unstable_useMemoCache as useMemoCache } from "react";
17 function component(a, b) {
18 - const $ = React.unstable_useMemoCache(6);
18 + const $ = useMemoCache(6);
19 const c_0 = $[0] !== a;
20 let t0;
21 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capturing-function-shadow-captured.expect.md
+2 -2
@@ -16,9 +16,9 @@ function component(a) {
16 ## Code
17
18 ```javascript
19 -import * as React from "react";
19 +import { unstable_useMemoCache as useMemoCache } from "react";
20 function component(a) {
21 - const $ = React.unstable_useMemoCache(1);
21 + const $ = useMemoCache(1);
22 let t0;
23 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
24 t0 = function () {
compiler/forget/src/__tests__/fixtures/compiler/capturing-function-skip-computed-path.expect.md
+2 -2
@@ -12,9 +12,9 @@ function StoreLandingUnseenGiftModalContainer(a) {
12 ## Code
13
14 ```javascript
15 -import * as React from "react";
15 +import { unstable_useMemoCache as useMemoCache } from "react";
16 function StoreLandingUnseenGiftModalContainer(a) {
17 - const $ = React.unstable_useMemoCache(2);
17 + const $ = useMemoCache(2);
18 const c_0 = $[0] !== a;
19 let t0;
20 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capturing-function-within-block.expect.md
+2 -2
@@ -18,9 +18,9 @@ function component(a) {
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function component(a) {
23 - const $ = React.unstable_useMemoCache(4);
23 + const $ = useMemoCache(4);
24 const c_0 = $[0] !== a;
25 let t0;
26 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capturing-member-expr.expect.md
+2 -2
@@ -15,9 +15,9 @@ function component(a) {
15 ## Code
16
17 ```javascript
18 -import * as React from "react";
18 +import { unstable_useMemoCache as useMemoCache } from "react";
19 function component(a) {
20 - const $ = React.unstable_useMemoCache(4);
20 + const $ = useMemoCache(4);
21 const c_0 = $[0] !== a;
22 let t0;
23 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capturing-nested-member-call.expect.md
+2 -2
@@ -15,9 +15,9 @@ function component(a) {
15 ## Code
16
17 ```javascript
18 -import * as React from "react";
18 +import { unstable_useMemoCache as useMemoCache } from "react";
19 function component(a) {
20 - const $ = React.unstable_useMemoCache(6);
20 + const $ = useMemoCache(6);
21 const c_0 = $[0] !== a;
22 let t0;
23 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capturing-nested-member-expr-in-nested-func.expect.md
+2 -2
@@ -17,9 +17,9 @@ function component(a) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 function component(a) {
22 - const $ = React.unstable_useMemoCache(6);
22 + const $ = useMemoCache(6);
23 const c_0 = $[0] !== a;
24 let t0;
25 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capturing-nested-member-expr.expect.md
+2 -2
@@ -15,9 +15,9 @@ function component(a) {
15 ## Code
16
17 ```javascript
18 -import * as React from "react";
18 +import { unstable_useMemoCache as useMemoCache } from "react";
19 function component(a) {
20 - const $ = React.unstable_useMemoCache(6);
20 + const $ = useMemoCache(6);
21 const c_0 = $[0] !== a;
22 let t0;
23 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capturing-variable-in-nested-block.expect.md
+2 -2
@@ -17,9 +17,9 @@ function component(a) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 function component(a) {
22 - const $ = React.unstable_useMemoCache(4);
22 + const $ = useMemoCache(4);
23 const c_0 = $[0] !== a;
24 let t0;
25 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/capturing-variable-in-nested-function.expect.md
+2 -2
@@ -17,9 +17,9 @@ function component(a) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 function component(a) {
22 - const $ = React.unstable_useMemoCache(4);
22 + const $ = useMemoCache(4);
23 const c_0 = $[0] !== a;
24 let t0;
25 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/chained-assignment-expressions.expect.md
+2 -2
@@ -16,9 +16,9 @@ function foo() {
16 ## Code
17
18 ```javascript
19 -import * as React from "react";
19 +import { unstable_useMemoCache as useMemoCache } from "react";
20 function foo() {
21 - const $ = React.unstable_useMemoCache(1);
21 + const $ = useMemoCache(1);
22 let z;
23 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
24 const x = { x: 0 };
compiler/forget/src/__tests__/fixtures/compiler/component.expect.md
+2 -2
@@ -34,9 +34,9 @@ function Component(props) {
34 ## Code
35
36 ```javascript
37 -import * as React from "react";
37 +import { unstable_useMemoCache as useMemoCache } from "react";
38 function Component(props) {
39 - const $ = React.unstable_useMemoCache(8);
39 + const $ = useMemoCache(8);
40 const items = props.items;
41 const maxItems = props.maxItems;
42 const c_0 = $[0] !== maxItems;
compiler/forget/src/__tests__/fixtures/compiler/computed-call-spread.expect.md
+2 -2
@@ -12,9 +12,9 @@ function Component(props) {
12 ## Code
13
14 ```javascript
15 -import * as React from "react";
15 +import { unstable_useMemoCache as useMemoCache } from "react";
16 function Component(props) {
17 - const $ = React.unstable_useMemoCache(4);
17 + const $ = useMemoCache(4);
18 const c_0 = $[0] !== props.method;
19 const c_1 = $[1] !== props.a;
20 const c_2 = $[2] !== props.b;
compiler/forget/src/__tests__/fixtures/compiler/computed-load-primitive-as-dependency.expect.md
+2 -2
@@ -17,9 +17,9 @@ function Component(props) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 function Component(props) {
22 - const $ = React.unstable_useMemoCache(2);
22 + const $ = useMemoCache(2);
23 const a = foo();
24
25 const t0 = a[props.a] + 1;
compiler/forget/src/__tests__/fixtures/compiler/computed-store-alias.expect.md
+2 -2
@@ -15,9 +15,9 @@ function component(a, b) {
15 ## Code
16
17 ```javascript
18 -import * as React from "react";
18 +import { unstable_useMemoCache as useMemoCache } from "react";
19 function component(a, b) {
20 - const $ = React.unstable_useMemoCache(3);
20 + const $ = useMemoCache(3);
21 const c_0 = $[0] !== a;
22 const c_1 = $[1] !== b;
23 let x;
compiler/forget/src/__tests__/fixtures/compiler/concise-arrow-expr.expect.md
+2 -2
@@ -13,9 +13,9 @@ function component() {
13 ## Code
14
15 ```javascript
16 -import * as React from "react";
16 +import { unstable_useMemoCache as useMemoCache } from "react";
17 function component() {
18 - const $ = React.unstable_useMemoCache(4);
18 + const $ = useMemoCache(4);
19 const [x, setX] = useState(0);
20 const c_0 = $[0] !== setX;
21 let t0;
compiler/forget/src/__tests__/fixtures/compiler/cond-deps-conditional-member-expr.expect.md
+2 -2
@@ -17,12 +17,12 @@ function Component(props) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react"; // To preserve the nullthrows behavior and reactive deps of this code,
20 +import { unstable_useMemoCache as useMemoCache } from "react"; // To preserve the nullthrows behavior and reactive deps of this code,
21 // Forget needs to add `props.a` as a dependency (since `props.a.b` is
22 // a conditional dependency, i.e. gated behind control flow)
23
24 function Component(props) {
25 - const $ = React.unstable_useMemoCache(2);
25 + const $ = useMemoCache(2);
26 const c_0 = $[0] !== props.a;
27 let x;
28 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/conditional-break-labeled.expect.md
+2 -2
@@ -23,12 +23,12 @@ function Component(props) {
23 ## Code
24
25 ```javascript
26 -import * as React from "react";
26 +import { unstable_useMemoCache as useMemoCache } from "react";
27 /**
28 * props.b *does* influence `a`
29 */
30 function Component(props) {
31 - const $ = React.unstable_useMemoCache(5);
31 + const $ = useMemoCache(5);
32 const c_0 = $[0] !== props.a;
33 const c_1 = $[1] !== props.b;
34 const c_2 = $[2] !== props.c;
compiler/forget/src/__tests__/fixtures/compiler/conditional-break.expect.md
+5 -5
@@ -61,12 +61,12 @@ function ComponentD(props) {
61 ## Code
62
63 ```javascript
64 -import * as React from "react";
64 +import { unstable_useMemoCache as useMemoCache } from "react";
65 /**
66 * props.b does *not* influence `a`
67 */
68 function ComponentA(props) {
69 - const $ = React.unstable_useMemoCache(4);
69 + const $ = useMemoCache(4);
70 const c_0 = $[0] !== props.a;
71 const c_1 = $[1] !== props.b;
72 const c_2 = $[2] !== props.d;
@@ -93,7 +93,7 @@ function ComponentA(props) {
93 * props.b *does* influence `a`
94 */
95 function ComponentB(props) {
96 - const $ = React.unstable_useMemoCache(2);
96 + const $ = useMemoCache(2);
97 const c_0 = $[0] !== props;
98 let a;
99 if (c_0) {
@@ -116,7 +116,7 @@ function ComponentB(props) {
116 * props.b *does* influence `a`, but only in a way that is never observable
117 */
118 function ComponentC(props) {
119 - const $ = React.unstable_useMemoCache(2);
119 + const $ = useMemoCache(2);
120 const c_0 = $[0] !== props;
121 let a;
122 if (c_0) {
@@ -140,7 +140,7 @@ function ComponentC(props) {
140 * props.b *does* influence `a`
141 */
142 function ComponentD(props) {
143 - const $ = React.unstable_useMemoCache(2);
143 + const $ = useMemoCache(2);
144 const c_0 = $[0] !== props;
145 let a;
146 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/conditional-on-mutable.expect.md
+3 -3
@@ -34,9 +34,9 @@ function mayMutate() {}
34 ## Code
35
36 ```javascript
37 -import * as React from "react";
37 +import { unstable_useMemoCache as useMemoCache } from "react";
38 function ComponentA(props) {
39 - const $ = React.unstable_useMemoCache(6);
39 + const $ = useMemoCache(6);
40 const c_0 = $[0] !== props;
41 let a;
42 let b;
@@ -71,7 +71,7 @@ function ComponentA(props) {
71 }
72
73 function ComponentB(props) {
74 - const $ = React.unstable_useMemoCache(6);
74 + const $ = useMemoCache(6);
75 const c_0 = $[0] !== props;
76 let a;
77 let b;
compiler/forget/src/__tests__/fixtures/compiler/constant-computed.expect.md
+2 -2
@@ -15,9 +15,9 @@ function Component(props) {
15 ## Code
16
17 ```javascript
18 -import * as React from "react";
18 +import { unstable_useMemoCache as useMemoCache } from "react";
19 function Component(props) {
20 - const $ = React.unstable_useMemoCache(2);
20 + const $ = useMemoCache(2);
21 const c_0 = $[0] !== props.foo;
22 let x;
23 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/constructor.expect.md
+2 -2
@@ -18,11 +18,11 @@ function Component(props) {
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function Foo() {}
23
24 function Component(props) {
25 - const $ = React.unstable_useMemoCache(3);
25 + const $ = useMemoCache(3);
26 let a;
27 let b;
28 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
compiler/forget/src/__tests__/fixtures/compiler/controlled-input.expect.md
+2 -2
@@ -13,9 +13,9 @@ function component() {
13 ## Code
14
15 ```javascript
16 -import * as React from "react";
16 +import { unstable_useMemoCache as useMemoCache } from "react";
17 function component() {
18 - const $ = React.unstable_useMemoCache(5);
18 + const $ = useMemoCache(5);
19 const [x, setX] = useState(0);
20 const c_0 = $[0] !== setX;
21 let t0;
compiler/forget/src/__tests__/fixtures/compiler/delete-computed-property.expect.md
+2 -2
@@ -14,9 +14,9 @@ function Component(props) {
14 ## Code
15
16 ```javascript
17 -import * as React from "react";
17 +import { unstable_useMemoCache as useMemoCache } from "react";
18 function Component(props) {
19 - const $ = React.unstable_useMemoCache(3);
19 + const $ = useMemoCache(3);
20 const c_0 = $[0] !== props.a;
21 const c_1 = $[1] !== props.b;
22 let x;
compiler/forget/src/__tests__/fixtures/compiler/delete-property.expect.md
+2 -2
@@ -13,9 +13,9 @@ function Component(props) {
13 ## Code
14
15 ```javascript
16 -import * as React from "react";
16 +import { unstable_useMemoCache as useMemoCache } from "react";
17 function Component(props) {
18 - const $ = React.unstable_useMemoCache(3);
18 + const $ = useMemoCache(3);
19 const c_0 = $[0] !== props.a;
20 const c_1 = $[1] !== props.b;
21 let x;
compiler/forget/src/__tests__/fixtures/compiler/dependencies-outputs.expect.md
+2 -2
@@ -22,9 +22,9 @@ function foo(a, b) {
22 ## Code
23
24 ```javascript
25 -import * as React from "react";
25 +import { unstable_useMemoCache as useMemoCache } from "react";
26 function foo(a, b) {
27 - const $ = React.unstable_useMemoCache(5);
27 + const $ = useMemoCache(5);
28 const c_0 = $[0] !== a;
29 let x;
30 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/dependencies.expect.md
+2 -2
@@ -23,9 +23,9 @@ function foo(x, y, z) {
23 ## Code
24
25 ```javascript
26 -import * as React from "react";
26 +import { unstable_useMemoCache as useMemoCache } from "react";
27 function foo(x, y, z) {
28 - const $ = React.unstable_useMemoCache(3);
28 + const $ = useMemoCache(3);
29 const items = [z];
30 items.push(x);
31 const c_0 = $[0] !== x;
compiler/forget/src/__tests__/fixtures/compiler/destructure-capture-global.expect.md
+2 -2
@@ -13,10 +13,10 @@ function component(a) {
13 ## Code
14
15 ```javascript
16 -import * as React from "react";
16 +import { unstable_useMemoCache as useMemoCache } from "react";
17 let someGlobal = {};
18 function component(a) {
19 - const $ = React.unstable_useMemoCache(2);
19 + const $ = useMemoCache(2);
20 const c_0 = $[0] !== a;
21 let t0;
22 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/destructuring-array-default.expect.md
+2 -2
@@ -12,9 +12,9 @@ function Component(props) {
12 ## Code
13
14 ```javascript
15 -import * as React from "react";
15 +import { unstable_useMemoCache as useMemoCache } from "react";
16 function Component(props) {
17 - const $ = React.unstable_useMemoCache(2);
17 + const $ = useMemoCache(2);
18 const [t0] = props.y;
19 const c_0 = $[0] !== t0;
20 let t1;
compiler/forget/src/__tests__/fixtures/compiler/destructuring-assignment-array-default.expect.md
+2 -2
@@ -17,9 +17,9 @@ function Component(props) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 function Component(props) {
22 - const $ = React.unstable_useMemoCache(2);
22 + const $ = useMemoCache(2);
23 let x = undefined;
24 if (props.cond) {
25 const [t0] = props.y;
compiler/forget/src/__tests__/fixtures/compiler/destructuring-assignment.expect.md
+2 -2
@@ -26,9 +26,9 @@ function foo(a, b, c) {
26 ## Code
27
28 ```javascript
29 -import * as React from "react";
29 +import { unstable_useMemoCache as useMemoCache } from "react";
30 function foo(a, b, c) {
31 - const $ = React.unstable_useMemoCache(5);
31 + const $ = useMemoCache(5);
32
33 const [d, t47] = a;
34 const [t49] = t47;
compiler/forget/src/__tests__/fixtures/compiler/destructuring-object-default.expect.md
+2 -2
@@ -12,9 +12,9 @@ function Component(props) {
12 ## Code
13
14 ```javascript
15 -import * as React from "react";
15 +import { unstable_useMemoCache as useMemoCache } from "react";
16 function Component(props) {
17 - const $ = React.unstable_useMemoCache(2);
17 + const $ = useMemoCache(2);
18 const { x: t0 } = props.y;
19 const c_0 = $[0] !== t0;
20 let t1;
compiler/forget/src/__tests__/fixtures/compiler/destructuring.expect.md
+2 -2
@@ -27,9 +27,9 @@ function foo(a, b, c) {
27 ## Code
28
29 ```javascript
30 -import * as React from "react";
30 +import { unstable_useMemoCache as useMemoCache } from "react";
31 function foo(a, b, c) {
32 - const $ = React.unstable_useMemoCache(18);
32 + const $ = useMemoCache(18);
33 const c_0 = $[0] !== a;
34 let t0;
35 let d;
compiler/forget/src/__tests__/fixtures/compiler/do-while-compound-test.expect.md
+2 -2
@@ -17,9 +17,9 @@ function Component(props) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 function Component(props) {
22 - const $ = React.unstable_useMemoCache(2);
22 + const $ = useMemoCache(2);
23 const c_0 = $[0] !== props;
24 let ret;
25 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/do-while-conditional-break.expect.md
+2 -2
@@ -18,9 +18,9 @@ function Component(props) {
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function Component(props) {
23 - const $ = React.unstable_useMemoCache(2);
23 + const $ = useMemoCache(2);
24 const c_0 = $[0] !== props;
25 let x;
26 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/do-while-continue.expect.md
+2 -2
@@ -21,9 +21,9 @@ function Component() {
21 ## Code
22
23 ```javascript
24 -import * as React from "react";
24 +import { unstable_useMemoCache as useMemoCache } from "react";
25 function Component() {
26 - const $ = React.unstable_useMemoCache(1);
26 + const $ = useMemoCache(1);
27 let ret;
28 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
29 const x = [0, 1, 2, 3];
compiler/forget/src/__tests__/fixtures/compiler/do-while-early-unconditional-break.expect.md
+2 -2
@@ -16,9 +16,9 @@ function Component(props) {
16 ## Code
17
18 ```javascript
19 -import * as React from "react";
19 +import { unstable_useMemoCache as useMemoCache } from "react";
20 function Component(props) {
21 - const $ = React.unstable_useMemoCache(1);
21 + const $ = useMemoCache(1);
22 let x;
23 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
24 x = [1, 2, 3];
compiler/forget/src/__tests__/fixtures/compiler/do-while-simple.expect.md
+2 -2
@@ -17,9 +17,9 @@ function Component() {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 function Component() {
22 - const $ = React.unstable_useMemoCache(1);
22 + const $ = useMemoCache(1);
23 let ret;
24 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
25 const x = [1, 2, 3];
compiler/forget/src/__tests__/fixtures/compiler/error.file-has-non-critical-errors.expect.md
+2 -2
@@ -18,14 +18,14 @@ function Good() {
18 ## Code
19
20 ```javascript
21 -import * as React from "react"; // @panicOnBailout false
21 +import { unstable_useMemoCache as useMemoCache } from "react"; // @panicOnBailout false
22 function Bad() {
23 var x = 1;
24 return <div>{x}</div>;
25 }
26
27 function Good() {
28 - const $ = React.unstable_useMemoCache(1);
28 + const $ = useMemoCache(1);
29 let t0;
30 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
31 t0 = <div>{1}</div>;
compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-destructured-rest-element.expect.md
+2 -2
@@ -15,9 +15,9 @@ function Component(props) {
15 ## Code
16
17 ```javascript
18 -import * as React from "react";
18 +import { unstable_useMemoCache as useMemoCache } from "react";
19 function Component(props) {
20 - const $ = React.unstable_useMemoCache(7);
20 + const $ = useMemoCache(7);
21 const c_0 = $[0] !== props.a;
22 let b;
23 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-jsx-child.expect.md
+2 -2
@@ -19,9 +19,9 @@ function foo(a, b, c) {
19 ## Code
20
21 ```javascript
22 -import * as React from "react";
22 +import { unstable_useMemoCache as useMemoCache } from "react";
23 function foo(a, b, c) {
24 - const $ = React.unstable_useMemoCache(9);
24 + const $ = useMemoCache(9);
25 const c_0 = $[0] !== a;
26 const c_1 = $[1] !== b;
27 const c_2 = $[2] !== c;
compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-logical.expect.md
+2 -2
@@ -16,9 +16,9 @@ function Component(props) {
16 ## Code
17
18 ```javascript
19 -import * as React from "react";
19 +import { unstable_useMemoCache as useMemoCache } from "react";
20 function Component(props) {
21 - const $ = React.unstable_useMemoCache(10);
21 + const $ = useMemoCache(10);
22 const c_0 = $[0] !== props.a;
23 let t0;
24 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-allocating-dependency.expect.md
+2 -2
@@ -23,9 +23,9 @@ function Component(props) {
23 ## Code
24
25 ```javascript
26 -import * as React from "react";
26 +import { unstable_useMemoCache as useMemoCache } from "react";
27 function Component(props) {
28 - const $ = React.unstable_useMemoCache(5);
28 + const $ = useMemoCache(5);
29 const c_0 = $[0] !== props.a;
30 let t0;
31 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-allocating-nested-dependency.expect.md
+2 -2
@@ -32,9 +32,9 @@ function Component(props) {
32 ## Code
33
34 ```javascript
35 -import * as React from "react";
35 +import { unstable_useMemoCache as useMemoCache } from "react";
36 function Component(props) {
37 - const $ = React.unstable_useMemoCache(7);
37 + const $ = useMemoCache(7);
38 const c_0 = $[0] !== props.a;
39 let t0;
40 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/escape-analysis-non-escaping-interleaved-primitive-dependency.expect.md
+2 -2
@@ -25,9 +25,9 @@ function Component(props) {
25 ## Code
26
27 ```javascript
28 -import * as React from "react";
28 +import { unstable_useMemoCache as useMemoCache } from "react";
29 function Component(props) {
30 - const $ = React.unstable_useMemoCache(3);
30 + const $ = useMemoCache(3);
31
32 const a = props.a + props.b;
33 const c_0 = $[0] !== a;
compiler/forget/src/__tests__/fixtures/compiler/extend-scopes-if.expect.md
+2 -2
@@ -22,9 +22,9 @@ function foo(a, b, c) {
22 ## Code
23
24 ```javascript
25 -import * as React from "react";
25 +import { unstable_useMemoCache as useMemoCache } from "react";
26 function foo(a, b, c) {
27 - const $ = React.unstable_useMemoCache(4);
27 + const $ = useMemoCache(4);
28 const c_0 = $[0] !== a;
29 const c_1 = $[1] !== b;
30 const c_2 = $[2] !== c;
compiler/forget/src/__tests__/fixtures/compiler/fbt-call-complex-param-value.expect.md
+2 -2
@@ -17,11 +17,11 @@ function Component(props) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 import fbt from "fbt";
22
23 function Component(props) {
24 - const $ = React.unstable_useMemoCache(4);
24 + const $ = useMemoCache(4);
25 const c_0 = $[0] !== props.name;
26 let t0;
27 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/fbt-call.expect.md
+2 -2
@@ -17,11 +17,11 @@ function Component(props) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 import fbt from "fbt";
22
23 function Component(props) {
24 - const $ = React.unstable_useMemoCache(4);
24 + const $ = useMemoCache(4);
25 const c_0 = $[0] !== props.count;
26 let t0;
27 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/fbt-params-complex-param-value.expect.md
+2 -2
@@ -17,11 +17,11 @@ function Component(props) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 import fbt from "fbt";
22
23 function Component(props) {
24 - const $ = React.unstable_useMemoCache(4);
24 + const $ = useMemoCache(4);
25 const c_0 = $[0] !== props.name;
26 let t1;
27 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/fbt-params.expect.md
+2 -2
@@ -17,11 +17,11 @@ function Component(props) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 import fbt from "fbt";
22
23 function Component(props) {
24 - const $ = React.unstable_useMemoCache(2);
24 + const $ = useMemoCache(2);
25 const c_0 = $[0] !== props.name;
26 let t0;
27 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/for-of-break.expect.md
+2 -2
@@ -15,9 +15,9 @@ function Component() {
15 ## Code
16
17 ```javascript
18 -import * as React from "react";
18 +import { unstable_useMemoCache as useMemoCache } from "react";
19 function Component() {
20 - const $ = React.unstable_useMemoCache(1);
20 + const $ = useMemoCache(1);
21 let t0;
22 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
23 t0 = [];
compiler/forget/src/__tests__/fixtures/compiler/for-of-conditional-break.expect.md
+2 -2
@@ -18,9 +18,9 @@ function Component() {
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function Component() {
23 - const $ = React.unstable_useMemoCache(2);
23 + const $ = useMemoCache(2);
24 let x;
25 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
26 x = [];
compiler/forget/src/__tests__/fixtures/compiler/for-of-continue.expect.md
+2 -2
@@ -19,9 +19,9 @@ function Component() {
19 ## Code
20
21 ```javascript
22 -import * as React from "react";
22 +import { unstable_useMemoCache as useMemoCache } from "react";
23 function Component() {
24 - const $ = React.unstable_useMemoCache(2);
24 + const $ = useMemoCache(2);
25 let t0;
26 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
27 t0 = [0, 1, 2, 3];
compiler/forget/src/__tests__/fixtures/compiler/for-of-destructure.expect.md
+2 -2
@@ -16,9 +16,9 @@ function Component() {
16 ## Code
17
18 ```javascript
19 -import * as React from "react";
19 +import { unstable_useMemoCache as useMemoCache } from "react";
20 function Component() {
21 - const $ = React.unstable_useMemoCache(1);
21 + const $ = useMemoCache(1);
22 let x;
23 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
24 x = [];
compiler/forget/src/__tests__/fixtures/compiler/for-of-mutate.expect.md
+2 -2
@@ -16,9 +16,9 @@ function Component(props) {
16 ## Code
17
18 ```javascript
19 -import * as React from "react";
19 +import { unstable_useMemoCache as useMemoCache } from "react";
20 function Component(props) {
21 - const $ = React.unstable_useMemoCache(2);
21 + const $ = useMemoCache(2);
22 let results;
23 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
24 const collection = [makeObject()];
compiler/forget/src/__tests__/fixtures/compiler/for-of-simple.expect.md
+2 -2
@@ -16,9 +16,9 @@ function Component() {
16 ## Code
17
18 ```javascript
19 -import * as React from "react";
19 +import { unstable_useMemoCache as useMemoCache } from "react";
20 function Component() {
21 - const $ = React.unstable_useMemoCache(1);
21 + const $ = useMemoCache(1);
22 let x;
23 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
24 x = [];
compiler/forget/src/__tests__/fixtures/compiler/frozen-after-alias.expect.md
+2 -2
@@ -18,9 +18,9 @@ function foo(x) {}
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function Component() {
23 - const $ = React.unstable_useMemoCache(1);
23 + const $ = useMemoCache(1);
24 let t0;
25 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
26 t0 = [];
compiler/forget/src/__tests__/fixtures/compiler/function-declaration-reassign.expect.md
+2 -2
@@ -15,9 +15,9 @@ function component() {
15 ## Code
16
17 ```javascript
18 -import * as React from "react";
18 +import { unstable_useMemoCache as useMemoCache } from "react";
19 function component() {
20 - const $ = React.unstable_useMemoCache(1);
20 + const $ = useMemoCache(1);
21 let t0;
22 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
23 t0 = {};
compiler/forget/src/__tests__/fixtures/compiler/function-declaration-redeclare.expect.md
+2 -2
@@ -15,9 +15,9 @@ function component() {
15 ## Code
16
17 ```javascript
18 -import * as React from "react";
18 +import { unstable_useMemoCache as useMemoCache } from "react";
19 function component() {
20 - const $ = React.unstable_useMemoCache(1);
20 + const $ = useMemoCache(1);
21 let t0;
22 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
23 t0 = function x() {};
compiler/forget/src/__tests__/fixtures/compiler/function-declaration-simple.expect.md
+2 -2
@@ -16,9 +16,9 @@ function component(a) {
16 ## Code
17
18 ```javascript
19 -import * as React from "react";
19 +import { unstable_useMemoCache as useMemoCache } from "react";
20 function component(a) {
21 - const $ = React.unstable_useMemoCache(3);
21 + const $ = useMemoCache(3);
22 const c_0 = $[0] !== a;
23 let t;
24 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/function-param-assignment-pattern.expect.md
+2 -2
@@ -11,9 +11,9 @@ function Component(x = "default", y = [{}]) {
11 ## Code
12
13 ```javascript
14 -import * as React from "react";
14 +import { unstable_useMemoCache as useMemoCache } from "react";
15 function Component(t24, t0) {
16 - const $ = React.unstable_useMemoCache(5);
16 + const $ = useMemoCache(5);
17 const x = t24 === undefined ? "default" : t24;
18 const c_0 = $[0] !== t0;
19 let t1;
compiler/forget/src/__tests__/fixtures/compiler/gating-test-export-default-function.expect.md
+3 -3
@@ -23,13 +23,13 @@ function Foo(props) {
23
24 ```javascript
25 import { isForgetEnabled_Fixtures } from "ReactForgetFeatureFlag";
26 -import * as React from "react"; // @gating @forgetDirective
26 +import { unstable_useMemoCache as useMemoCache } from "react"; // @gating @forgetDirective
27 function Bar_uncompiled(props) {
28 "use forget";
29 return <div>{props.bar}</div>;
30 }
31 function Bar_forget(props) {
32 - const $ = React.unstable_useMemoCache(2);
32 + const $ = useMemoCache(2);
33 const c_0 = $[0] !== props.bar;
34 let t0;
35 if (c_0) {
@@ -53,7 +53,7 @@ function Foo_uncompiled(props) {
53 return <Foo>{props.bar}</Foo>;
54 }
55 function Foo_forget(props) {
56 - const $ = React.unstable_useMemoCache(2);
56 + const $ = useMemoCache(2);
57 const c_0 = $[0] !== props.bar;
58 let t0;
59 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/gating-test-export-function-and-default.expect.md
+3 -3
@@ -23,13 +23,13 @@ export function Foo(props) {
23
24 ```javascript
25 import { isForgetEnabled_Fixtures } from "ReactForgetFeatureFlag";
26 -import * as React from "react"; // @gating @forgetDirective
26 +import { unstable_useMemoCache as useMemoCache } from "react"; // @gating @forgetDirective
27 function Bar_uncompiled(props) {
28 "use forget";
29 return <div>{props.bar}</div>;
30 }
31 function Bar_forget(props) {
32 - const $ = React.unstable_useMemoCache(2);
32 + const $ = useMemoCache(2);
33 const c_0 = $[0] !== props.bar;
34 let t0;
35 if (c_0) {
@@ -53,7 +53,7 @@ function Foo_uncompiled(props) {
53 return <Foo>{props.bar}</Foo>;
54 }
55 function Foo_forget(props) {
56 - const $ = React.unstable_useMemoCache(2);
56 + const $ = useMemoCache(2);
57 const c_0 = $[0] !== props.bar;
58 let t0;
59 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/gating-test-export-function.expect.md
+3 -3
@@ -23,13 +23,13 @@ export function Foo(props) {
23
24 ```javascript
25 import { isForgetEnabled_Fixtures } from "ReactForgetFeatureFlag";
26 -import * as React from "react"; // @gating @forgetDirective
26 +import { unstable_useMemoCache as useMemoCache } from "react"; // @gating @forgetDirective
27 function Bar_uncompiled(props) {
28 "use forget";
29 return <div>{props.bar}</div>;
30 }
31 function Bar_forget(props) {
32 - const $ = React.unstable_useMemoCache(2);
32 + const $ = useMemoCache(2);
33 const c_0 = $[0] !== props.bar;
34 let t0;
35 if (c_0) {
@@ -52,7 +52,7 @@ function Foo_uncompiled(props) {
52 return <Foo>{props.bar}</Foo>;
53 }
54 function Foo_forget(props) {
55 - const $ = React.unstable_useMemoCache(2);
55 + const $ = useMemoCache(2);
56 const c_0 = $[0] !== props.bar;
57 let t0;
58 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/gating-test.expect.md
+3 -3
@@ -23,13 +23,13 @@ function Foo(props) {
23
24 ```javascript
25 import { isForgetEnabled_Fixtures } from "ReactForgetFeatureFlag";
26 -import * as React from "react"; // @gating @forgetDirective
26 +import { unstable_useMemoCache as useMemoCache } from "react"; // @gating @forgetDirective
27 function Bar_uncompiled(props) {
28 "use forget";
29 return <div>{props.bar}</div>;
30 }
31 function Bar_forget(props) {
32 - const $ = React.unstable_useMemoCache(2);
32 + const $ = useMemoCache(2);
33 const c_0 = $[0] !== props.bar;
34 let t0;
35 if (c_0) {
@@ -52,7 +52,7 @@ function Foo_uncompiled(props) {
52 return <Foo>{props.bar}</Foo>;
53 }
54 function Foo_forget(props) {
55 - const $ = React.unstable_useMemoCache(2);
55 + const $ = useMemoCache(2);
56 const c_0 = $[0] !== props.bar;
57 let t0;
58 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/hook-call.expect.md
+2 -2
@@ -22,12 +22,12 @@ function Component(props) {
22 ## Code
23
24 ```javascript
25 -import * as React from "react";
25 +import { unstable_useMemoCache as useMemoCache } from "react";
26 function useFreeze() {}
27 function foo() {}
28
29 function Component(props) {
30 - const $ = React.unstable_useMemoCache(3);
30 + const $ = useMemoCache(3);
31 let t0;
32 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
33 t0 = [];
compiler/forget/src/__tests__/fixtures/compiler/hooks-freeze-arguments.expect.md
+2 -2
@@ -18,9 +18,9 @@ function call(x) {}
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function Component() {
23 - const $ = React.unstable_useMemoCache(1);
23 + const $ = useMemoCache(1);
24 let t0;
25 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
26 t0 = [];
compiler/forget/src/__tests__/fixtures/compiler/hooks-freeze-possibly-mutable-arguments.expect.md
+2 -2
@@ -25,9 +25,9 @@ function call(x) {}
25 ## Code
26
27 ```javascript
28 -import * as React from "react";
28 +import { unstable_useMemoCache as useMemoCache } from "react";
29 function Component(props) {
30 - const $ = React.unstable_useMemoCache(1);
30 + const $ = useMemoCache(1);
31 const cond = props.cond;
32 const x = props.x;
33 let a = undefined;
compiler/forget/src/__tests__/fixtures/compiler/inadvertent-mutability-readonly-lambda.expect.md
+2 -2
@@ -21,9 +21,9 @@ function Component(props) {
21 ## Code
22
23 ```javascript
24 -import * as React from "react";
24 +import { unstable_useMemoCache as useMemoCache } from "react";
25 function Component(props) {
26 - const $ = React.unstable_useMemoCache(4);
26 + const $ = useMemoCache(4);
27 const [value, setValue] = useState(null);
28 const c_0 = $[0] !== setValue;
29 let t0;
compiler/forget/src/__tests__/fixtures/compiler/independent-across-if.expect.md
+2 -2
@@ -36,7 +36,7 @@ function Component(props) {
36 ## Code
37
38 ```javascript
39 -import * as React from "react";
39 +import { unstable_useMemoCache as useMemoCache } from "react";
40 function compute() {}
41 function mutate() {}
42 function foo() {}
@@ -57,7 +57,7 @@ function Foo() {}
57 * return = <Foo a={a} b={b} />
58 */
59 function Component(props) {
60 - const $ = React.unstable_useMemoCache(8);
60 + const $ = useMemoCache(8);
61 const c_0 = $[0] !== props.a;
62 const c_1 = $[1] !== props.b;
63 const c_2 = $[2] !== props.c;
compiler/forget/src/__tests__/fixtures/compiler/independent.expect.md
+2 -2
@@ -27,7 +27,7 @@ function Foo() {}
27 ## Code
28
29 ```javascript
30 -import * as React from "react";
30 +import { unstable_useMemoCache as useMemoCache } from "react";
31 /**
32 * Should produce 3 scopes:
33 *
@@ -39,7 +39,7 @@ import * as React from "react";
39 * return = <Foo a={a} b={b} />
40 */
41 function Component(props) {
42 - const $ = React.unstable_useMemoCache(7);
42 + const $ = useMemoCache(7);
43 const c_0 = $[0] !== props.a;
44 let t0;
45 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/independently-memoize-object-property.expect.md
+2 -2
@@ -15,9 +15,9 @@ function foo(a, b, c) {
15 ## Code
16
17 ```javascript
18 -import * as React from "react";
18 +import { unstable_useMemoCache as useMemoCache } from "react";
19 function foo(a, b, c) {
20 - const $ = React.unstable_useMemoCache(7);
20 + const $ = useMemoCache(7);
21 const c_0 = $[0] !== a;
22 const c_1 = $[1] !== b;
23 const c_2 = $[2] !== c;
compiler/forget/src/__tests__/fixtures/compiler/infer-global-object.expect.md
+2 -2
@@ -21,10 +21,10 @@ function Component(props) {
21 ## Code
22
23 ```javascript
24 -import * as React from "react"; // Check that we correctly resolve type and effect lookups on the javascript
24 +import { unstable_useMemoCache as useMemoCache } from "react"; // Check that we correctly resolve type and effect lookups on the javascript
25 // global object.
26 function Component(props) {
27 - const $ = React.unstable_useMemoCache(7);
27 + const $ = useMemoCache(7);
28 const c_0 = $[0] !== props.b;
29 let t0;
30 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/inner-memo-value-not-promoted-to-outer-scope-dynamic.expect.md
+2 -2
@@ -22,9 +22,9 @@ function Component(props) {
22 ## Code
23
24 ```javascript
25 -import * as React from "react";
25 +import { unstable_useMemoCache as useMemoCache } from "react";
26 function Component(props) {
27 - const $ = React.unstable_useMemoCache(23);
27 + const $ = useMemoCache(23);
28 const item = useFragment(FRAGMENT, props.item);
29 useFreeze(item);
30 const c_0 = $[0] !== item;
compiler/forget/src/__tests__/fixtures/compiler/inner-memo-value-not-promoted-to-outer-scope-static.expect.md
+2 -2
@@ -19,9 +19,9 @@ function Component(props) {
19 ## Code
20
21 ```javascript
22 -import * as React from "react";
22 +import { unstable_useMemoCache as useMemoCache } from "react";
23 function Component(props) {
24 - const $ = React.unstable_useMemoCache(12);
24 + const $ = useMemoCache(12);
25 let t1;
26 let t2;
27 let t3;
compiler/forget/src/__tests__/fixtures/compiler/interdependent-across-if.expect.md
+2 -2
@@ -30,7 +30,7 @@ function Component(props) {
30 ## Code
31
32 ```javascript
33 -import * as React from "react";
33 +import { unstable_useMemoCache as useMemoCache } from "react";
34 function compute() {}
35 function foo() {}
36 function Foo() {}
@@ -46,7 +46,7 @@ function Foo() {}
46 * return = <Foo a={a} b={b} />
47 */
48 function Component(props) {
49 - const $ = React.unstable_useMemoCache(8);
49 + const $ = useMemoCache(8);
50 const c_0 = $[0] !== props.a;
51 const c_1 = $[1] !== props.b;
52 const c_2 = $[2] !== props.c;
compiler/forget/src/__tests__/fixtures/compiler/interdependent.expect.md
+2 -2
@@ -27,7 +27,7 @@ function Foo() {}
27 ## Code
28
29 ```javascript
30 -import * as React from "react";
30 +import { unstable_useMemoCache as useMemoCache } from "react";
31 /**
32 * Should produce 1 scope:
33 *
@@ -38,7 +38,7 @@ import * as React from "react";
38 * return = <Foo a={a} b={b} />
39 */
40 function Component(props) {
41 - const $ = React.unstable_useMemoCache(7);
41 + const $ = useMemoCache(7);
42 const c_0 = $[0] !== props.a;
43 const c_1 = $[1] !== props.b;
44 let a;
compiler/forget/src/__tests__/fixtures/compiler/inverted-if.expect.md
+2 -2
@@ -19,9 +19,9 @@ function foo(a, b, c, d) {
19 ## Code
20
21 ```javascript
22 -import * as React from "react";
22 +import { unstable_useMemoCache as useMemoCache } from "react";
23 function foo(a, b, c, d) {
24 - const $ = React.unstable_useMemoCache(5);
24 + const $ = useMemoCache(5);
25 const c_0 = $[0] !== a;
26 const c_1 = $[1] !== b;
27 const c_2 = $[2] !== c;
compiler/forget/src/__tests__/fixtures/compiler/issue933-disjoint-set-infinite-loop.expect.md
+2 -2
@@ -16,9 +16,9 @@ function MyApp(props) {
16 ## Code
17
18 ```javascript
19 -import * as React from "react"; // This caused an infinite loop in the compiler
19 +import { unstable_useMemoCache as useMemoCache } from "react"; // This caused an infinite loop in the compiler
20 function MyApp(props) {
21 - const $ = React.unstable_useMemoCache(1);
21 + const $ = useMemoCache(1);
22 let y;
23 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
24 y = makeObj();
compiler/forget/src/__tests__/fixtures/compiler/jsx-empty-expression.expect.md
+2 -2
@@ -16,9 +16,9 @@ export function Component(props) {
16 ## Code
17
18 ```javascript
19 -import * as React from "react";
19 +import { unstable_useMemoCache as useMemoCache } from "react";
20 export function Component(props) {
21 - const $ = React.unstable_useMemoCache(2);
21 + const $ = useMemoCache(2);
22 const c_0 = $[0] !== props.a;
23 let t0;
24 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/jsx-fragment.expect.md
+2 -2
@@ -18,9 +18,9 @@ function Foo(props) {
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function Foo(props) {
23 - const $ = React.unstable_useMemoCache(4);
23 + const $ = useMemoCache(4);
24 let t0;
25 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
26 t0 = <>Text</>;
compiler/forget/src/__tests__/fixtures/compiler/jsx-member-expression.expect.md
+2 -2
@@ -15,9 +15,9 @@ function Component(props) {
15 ## Code
16
17 ```javascript
18 -import * as React from "react";
18 +import { unstable_useMemoCache as useMemoCache } from "react";
19 function Component(props) {
20 - const $ = React.unstable_useMemoCache(2);
20 + const $ = useMemoCache(2);
21 let t0;
22 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
23 t0 = <Foo.Bar.Baz />;
compiler/forget/src/__tests__/fixtures/compiler/jsx-namespaced-name.expect.md
+2 -2
@@ -11,9 +11,9 @@ function Component(props) {
11 ## Code
12
13 ```javascript
14 -import * as React from "react";
14 +import { unstable_useMemoCache as useMemoCache } from "react";
15 function Component(props) {
16 - const $ = React.unstable_useMemoCache(2);
16 + const $ = useMemoCache(2);
17 const c_0 = $[0] !== props.version;
18 let t0;
19 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/jsx-spread.expect.md
+2 -2
@@ -13,9 +13,9 @@ function Component(props) {
13 ## Code
14
15 ```javascript
16 -import * as React from "react";
16 +import { unstable_useMemoCache as useMemoCache } from "react";
17 function Component(props) {
18 - const $ = React.unstable_useMemoCache(5);
18 + const $ = useMemoCache(5);
19
20 const t0 = props.cond ? props.foo : props.bar;
21 const c_0 = $[0] !== t0;
compiler/forget/src/__tests__/fixtures/compiler/jsx-tag-evaluation-order-non-global.expect.md
+2 -2
@@ -21,9 +21,9 @@ function Component(props) {
21 ## Code
22
23 ```javascript
24 -import * as React from "react";
24 +import { unstable_useMemoCache as useMemoCache } from "react";
25 function Component(props) {
26 - const $ = React.unstable_useMemoCache(13);
26 + const $ = useMemoCache(13);
27 const c_0 = $[0] !== props.component;
28 const c_1 = $[1] !== props.alternateComponent;
29 let Tag;
compiler/forget/src/__tests__/fixtures/compiler/jsx-tag-evaluation-order.expect.md
+2 -2
@@ -17,9 +17,9 @@ function Component(props) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 function Component(props) {
22 - const $ = React.unstable_useMemoCache(3);
22 + const $ = useMemoCache(3);
23 let t0;
24 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
25 t0 = <HScroll />;
compiler/forget/src/__tests__/fixtures/compiler/lambda-capture-returned-alias.expect.md
+2 -2
@@ -26,14 +26,14 @@ function CaptureNotMutate(props) {
26 ## Code
27
28 ```javascript
29 -import * as React from "react"; // Here, element should not be memoized independently of aliasedElement, since
29 +import { unstable_useMemoCache as useMemoCache } from "react"; // Here, element should not be memoized independently of aliasedElement, since
30 // it is captured by fn.
31 // AnalyzeFunctions currently does not find captured objects.
32 // - mutated context refs are declared as `Capture` effect in `FunctionExpression.deps`
33 // - all other context refs are left as Unknown. InferReferenceEffects currently demotes
34 // them to reads
35 function CaptureNotMutate(props) {
36 - const $ = React.unstable_useMemoCache(5);
36 + const $ = useMemoCache(5);
37 const c_0 = $[0] !== props.x;
38 let t0;
39 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/lambda-mutate-shadowed-object.expect.md
+2 -2
@@ -19,9 +19,9 @@ function Component() {
19 ## Code
20
21 ```javascript
22 -import * as React from "react";
22 +import { unstable_useMemoCache as useMemoCache } from "react";
23 function Component() {
24 - const $ = React.unstable_useMemoCache(1);
24 + const $ = useMemoCache(1);
25 let t0;
26 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
27 t0 = {};
compiler/forget/src/__tests__/fixtures/compiler/logical-expression-object.expect.md
+2 -2
@@ -18,9 +18,9 @@ function component(props) {
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function component(props) {
23 - const $ = React.unstable_useMemoCache(3);
23 + const $ = useMemoCache(3);
24
25 const a = props.a || (props.b && props.c && props.d);
26 const b = (props.a && props.b && props.c) || props.d;
compiler/forget/src/__tests__/fixtures/compiler/method-call-computed.expect.md
+2 -2
@@ -21,9 +21,9 @@ function foo(a, b, c) {
21 ## Code
22
23 ```javascript
24 -import * as React from "react";
24 +import { unstable_useMemoCache as useMemoCache } from "react";
25 function foo(a, b, c) {
26 - const $ = React.unstable_useMemoCache(8);
26 + const $ = useMemoCache(8);
27 const c_0 = $[0] !== a;
28 let t0;
29 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/method-call-fn-call.expect.md
+2 -2
@@ -18,9 +18,9 @@ function foo(a, b, c) {
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function foo(a, b, c) {
23 - const $ = React.unstable_useMemoCache(6);
23 + const $ = useMemoCache(6);
24 const c_0 = $[0] !== a;
25 let t0;
26 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/method-call.expect.md
+2 -2
@@ -17,9 +17,9 @@ function foo(a, b, c) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 function foo(a, b, c) {
22 - const $ = React.unstable_useMemoCache(5);
22 + const $ = useMemoCache(5);
23 const c_0 = $[0] !== a;
24 let t0;
25 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/multi-arrow-expr-export-gating-test.expect.md
+3 -3
@@ -18,12 +18,12 @@ export const Renderer = (props) => (
18
19 ```javascript
20 import { isForgetEnabled_Fixtures } from "ReactForgetFeatureFlag";
21 -import * as React from "react"; // @gating
21 +import { unstable_useMemoCache as useMemoCache } from "react"; // @gating
22 function ErrorView_uncompiled(error, _retry) {
23 return <MessageBox error={error}></MessageBox>;
24 }
25 function ErrorView_forget(error, _retry) {
26 - const $ = React.unstable_useMemoCache(2);
26 + const $ = useMemoCache(2);
27 const c_0 = $[0] !== error;
28 let t0;
29 if (c_0) {
@@ -47,7 +47,7 @@ function Renderer_uncompiled(props) {
47 );
48 }
49 function Renderer_forget(props) {
50 - const $ = React.unstable_useMemoCache(3);
50 + const $ = useMemoCache(3);
51 let t0;
52 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
53 t0 = <Bar />;
compiler/forget/src/__tests__/fixtures/compiler/multi-arrow-expr-gating-test.expect.md
+3 -3
@@ -20,12 +20,12 @@ export default Renderer;
20
21 ```javascript
22 import { isForgetEnabled_Fixtures } from "ReactForgetFeatureFlag";
23 -import * as React from "react"; // @gating
23 +import { unstable_useMemoCache as useMemoCache } from "react"; // @gating
24 function ErrorView_uncompiled(error, _retry) {
25 return <MessageBox error={error}></MessageBox>;
26 }
27 function ErrorView_forget(error, _retry) {
28 - const $ = React.unstable_useMemoCache(2);
28 + const $ = useMemoCache(2);
29 const c_0 = $[0] !== error;
30 let t0;
31 if (c_0) {
@@ -49,7 +49,7 @@ function Renderer_uncompiled(props) {
49 );
50 }
51 function Renderer_forget(props) {
52 - const $ = React.unstable_useMemoCache(3);
52 + const $ = useMemoCache(3);
53 let t0;
54 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
55 t0 = <Bar />;
compiler/forget/src/__tests__/fixtures/compiler/nested-function-shadowed-identifiers.expect.md
+2 -2
@@ -18,9 +18,9 @@ function Component(props) {
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function Component(props) {
23 - const $ = React.unstable_useMemoCache(5);
23 + const $ = useMemoCache(5);
24 const [x, setX] = useState(null);
25 const c_0 = $[0] !== setX;
26 let t0;
compiler/forget/src/__tests__/fixtures/compiler/nested-optional-member-expr.expect.md
+2 -2
@@ -14,10 +14,10 @@ function Component(props) {
14 ## Code
15
16 ```javascript
17 -import * as React from "react"; // We should codegen nested optional properties correctly
17 +import { unstable_useMemoCache as useMemoCache } from "react"; // We should codegen nested optional properties correctly
18 // (i.e. placing `?` in the correct PropertyLoad)
19 function Component(props) {
20 - const $ = React.unstable_useMemoCache(2);
20 + const $ = useMemoCache(2);
21 const c_0 = $[0] !== props.a;
22 let t0;
23 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/new-spread.expect.md
+2 -2
@@ -12,9 +12,9 @@ function Component(props) {
12 ## Code
13
14 ```javascript
15 -import * as React from "react";
15 +import { unstable_useMemoCache as useMemoCache } from "react";
16 function Component(props) {
17 - const $ = React.unstable_useMemoCache(3);
17 + const $ = useMemoCache(3);
18 const c_0 = $[0] !== props.bar;
19 const c_1 = $[1] !== props.foo;
20 let t0;
compiler/forget/src/__tests__/fixtures/compiler/obj-literal-cached-in-if-else.expect.md
+2 -2
@@ -18,9 +18,9 @@ function foo(a, b, c, d) {
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function foo(a, b, c, d) {
23 - const $ = React.unstable_useMemoCache(4);
23 + const $ = useMemoCache(4);
24 let x = undefined;
25 if (someVal) {
26 const c_0 = $[0] !== b;
compiler/forget/src/__tests__/fixtures/compiler/obj-literal-mutated-after-if-else.expect.md
+2 -2
@@ -19,9 +19,9 @@ function foo(a, b, c, d) {
19 ## Code
20
21 ```javascript
22 -import * as React from "react";
22 +import { unstable_useMemoCache as useMemoCache } from "react";
23 function foo(a, b, c, d) {
24 - const $ = React.unstable_useMemoCache(3);
24 + const $ = useMemoCache(3);
25 const c_0 = $[0] !== b;
26 const c_1 = $[1] !== c;
27 let x;
compiler/forget/src/__tests__/fixtures/compiler/obj-mutated-after-if-else-with-alias.expect.md
+2 -2
@@ -21,9 +21,9 @@ function foo(a, b, c, d) {
21 ## Code
22
23 ```javascript
24 -import * as React from "react";
24 +import { unstable_useMemoCache as useMemoCache } from "react";
25 function foo(a, b, c, d) {
26 - const $ = React.unstable_useMemoCache(2);
26 + const $ = useMemoCache(2);
27 someObj();
28 const c_0 = $[0] !== a;
29 let x;
compiler/forget/src/__tests__/fixtures/compiler/obj-mutated-after-if-else.expect.md
+2 -2
@@ -19,9 +19,9 @@ function foo(a, b, c, d) {
19 ## Code
20
21 ```javascript
22 -import * as React from "react";
22 +import { unstable_useMemoCache as useMemoCache } from "react";
23 function foo(a, b, c, d) {
24 - const $ = React.unstable_useMemoCache(2);
24 + const $ = useMemoCache(2);
25 someObj();
26 const c_0 = $[0] !== a;
27 let x;
compiler/forget/src/__tests__/fixtures/compiler/obj-mutated-after-nested-if-else-with-alias.expect.md
+2 -2
@@ -27,9 +27,9 @@ function foo(a, b, c, d) {
27 ## Code
28
29 ```javascript
30 -import * as React from "react";
30 +import { unstable_useMemoCache as useMemoCache } from "react";
31 function foo(a, b, c, d) {
32 - const $ = React.unstable_useMemoCache(3);
32 + const $ = useMemoCache(3);
33 someObj();
34 const c_0 = $[0] !== a;
35 const c_1 = $[1] !== b;
compiler/forget/src/__tests__/fixtures/compiler/object-expression-string-literal-key.expect.md
+2 -2
@@ -12,9 +12,9 @@ function Component(props) {
12 ## Code
13
14 ```javascript
15 -import * as React from "react";
15 +import { unstable_useMemoCache as useMemoCache } from "react";
16 function Component(props) {
17 - const $ = React.unstable_useMemoCache(2);
17 + const $ = useMemoCache(2);
18 const c_0 = $[0] !== props.foo;
19 let t0;
20 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/object-literal-spread-element.expect.md
+2 -2
@@ -12,9 +12,9 @@ function Component(props) {
12 ## Code
13
14 ```javascript
15 -import * as React from "react";
15 +import { unstable_useMemoCache as useMemoCache } from "react";
16 function Component(props) {
17 - const $ = React.unstable_useMemoCache(2);
17 + const $ = useMemoCache(2);
18 const c_0 = $[0] !== props.foo;
19 let t0;
20 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/object-pattern-params.expect.md
+2 -2
@@ -13,9 +13,9 @@ function component({ a, b }) {
13 ## Code
14
15 ```javascript
16 -import * as React from "react";
16 +import { unstable_useMemoCache as useMemoCache } from "react";
17 function component(t17) {
18 - const $ = React.unstable_useMemoCache(7);
18 + const $ = useMemoCache(7);
19 const { a, b } = t17;
20 const c_0 = $[0] !== a;
21 let t0;
compiler/forget/src/__tests__/fixtures/compiler/optional-call-with-independently-memoizable-arg.expect.md
+2 -2
@@ -21,9 +21,9 @@ function Component(props) {
21 ## Code
22
23 ```javascript
24 -import * as React from "react";
24 +import { unstable_useMemoCache as useMemoCache } from "react";
25 function Component(props) {
26 - const $ = React.unstable_useMemoCache(2);
26 + const $ = useMemoCache(2);
27 const c_0 = $[0] !== props;
28 let t0;
29 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/optional-call.expect.md
+2 -2
@@ -14,9 +14,9 @@ function Component(props) {
14 ## Code
15
16 ```javascript
17 -import * as React from "react";
17 +import { unstable_useMemoCache as useMemoCache } from "react";
18 function Component(props) {
19 - const $ = React.unstable_useMemoCache(2);
19 + const $ = useMemoCache(2);
20 const c_0 = $[0] !== props;
21 let t0;
22 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/optional-member-expression-chain.expect.md
+2 -2
@@ -15,10 +15,10 @@ function Component(props) {
15 ## Code
16
17 ```javascript
18 -import * as React from "react"; // Note that `a?.b.c` is semantically different from `(a?.b).c`
18 +import { unstable_useMemoCache as useMemoCache } from "react"; // Note that `a?.b.c` is semantically different from `(a?.b).c`
19 // We should codegen the correct member expressions
20 function Component(props) {
21 - const $ = React.unstable_useMemoCache(3);
21 + const $ = useMemoCache(3);
22 const x = props?.b.c;
23 const y = props?.b.c.d?.e.f.g?.h;
24 const c_0 = $[0] !== x;
compiler/forget/src/__tests__/fixtures/compiler/optional-method-call.expect.md
+2 -2
@@ -14,9 +14,9 @@ function Component(props) {
14 ## Code
15
16 ```javascript
17 -import * as React from "react";
17 +import { unstable_useMemoCache as useMemoCache } from "react";
18 function Component(props) {
19 - const $ = React.unstable_useMemoCache(2);
19 + const $ = useMemoCache(2);
20 const c_0 = $[0] !== props;
21 let t0;
22 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/optional-receiver-method-call.expect.md
+2 -2
@@ -14,9 +14,9 @@ function Component(props) {
14 ## Code
15
16 ```javascript
17 -import * as React from "react";
17 +import { unstable_useMemoCache as useMemoCache } from "react";
18 function Component(props) {
19 - const $ = React.unstable_useMemoCache(2);
19 + const $ = useMemoCache(2);
20 const c_0 = $[0] !== props;
21 let t0;
22 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/optional-receiver-optional-method.expect.md
+2 -2
@@ -14,9 +14,9 @@ function Component(props) {
14 ## Code
15
16 ```javascript
17 -import * as React from "react";
17 +import { unstable_useMemoCache as useMemoCache } from "react";
18 function Component(props) {
19 - const $ = React.unstable_useMemoCache(2);
19 + const $ = useMemoCache(2);
20 const c_0 = $[0] !== props;
21 let t0;
22 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/overlapping-scopes-shadowing-within-block.expect.md
+2 -2
@@ -20,9 +20,9 @@ function foo(a, b, c) {
20 ## Code
21
22 ```javascript
23 -import * as React from "react";
23 +import { unstable_useMemoCache as useMemoCache } from "react";
24 function foo(a, b, c) {
25 - const $ = React.unstable_useMemoCache(9);
25 + const $ = useMemoCache(9);
26 const c_0 = $[0] !== a;
27 const c_1 = $[1] !== b;
28 const c_2 = $[2] !== c;
compiler/forget/src/__tests__/fixtures/compiler/overlapping-scopes-within-block.expect.md
+2 -2
@@ -20,9 +20,9 @@ function foo(a, b, c) {
20 ## Code
21
22 ```javascript
23 -import * as React from "react";
23 +import { unstable_useMemoCache as useMemoCache } from "react";
24 function foo(a, b, c) {
25 - const $ = React.unstable_useMemoCache(7);
25 + const $ = useMemoCache(7);
26 const c_0 = $[0] !== a;
27 const c_1 = $[1] !== b;
28 const c_2 = $[2] !== c;
compiler/forget/src/__tests__/fixtures/compiler/primitive-as-dep-nested-scope.expect.md
+2 -2
@@ -20,13 +20,13 @@ function PrimitiveAsDepNested(props) {
20 ## Code
21
22 ```javascript
23 -import * as React from "react"; // props.b + 1 is an non-allocating expression, which means Forget can
23 +import { unstable_useMemoCache as useMemoCache } from "react"; // props.b + 1 is an non-allocating expression, which means Forget can
24 // emit it trivially and repeatedly (e.g. no need to memoize props.b + 1
25 // separately from props.b)
26 // Correctness:
27 // y depends on either props.b or props.b + 1
28 function PrimitiveAsDepNested(props) {
29 - const $ = React.unstable_useMemoCache(9);
29 + const $ = useMemoCache(9);
30 const c_0 = $[0] !== props.b;
31 const c_1 = $[1] !== props.a;
32 let x;
compiler/forget/src/__tests__/fixtures/compiler/primitive-as-dep.expect.md
+2 -2
@@ -17,13 +17,13 @@ function PrimitiveAsDep(props) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react"; // props.b + 1 is an non-allocating expression, which means Forget can
20 +import { unstable_useMemoCache as useMemoCache } from "react"; // props.b + 1 is an non-allocating expression, which means Forget can
21 // emit it trivially and repeatedly (e.g. no need to memoize props.b + 1
22 // separately from props.b)
23 // Correctness:
24 // y depends on either props.b or props.b + 1
25 function PrimitiveAsDep(props) {
26 - const $ = React.unstable_useMemoCache(2);
26 + const $ = useMemoCache(2);
27 const t0 = props.b + 1;
28 const c_0 = $[0] !== t0;
29 let t1;
compiler/forget/src/__tests__/fixtures/compiler/prop-capturing-function-1.expect.md
+2 -2
@@ -15,9 +15,9 @@ function component(a, b) {
15 ## Code
16
17 ```javascript
18 -import * as React from "react";
18 +import { unstable_useMemoCache as useMemoCache } from "react";
19 function component(a, b) {
20 - const $ = React.unstable_useMemoCache(5);
20 + const $ = useMemoCache(5);
21 const c_0 = $[0] !== a;
22 const c_1 = $[1] !== b;
23 let t0;
compiler/forget/src/__tests__/fixtures/compiler/property-assignment.expect.md
+2 -2
@@ -16,9 +16,9 @@ function Component(props) {
16 ## Code
17
18 ```javascript
19 -import * as React from "react";
19 +import { unstable_useMemoCache as useMemoCache } from "react";
20 function Component(props) {
21 - const $ = React.unstable_useMemoCache(6);
21 + const $ = useMemoCache(6);
22 const c_0 = $[0] !== props.p0;
23 let x;
24 let child;
compiler/forget/src/__tests__/fixtures/compiler/property-call-spread.expect.md
+2 -2
@@ -12,9 +12,9 @@ function Component(props) {
12 ## Code
13
14 ```javascript
15 -import * as React from "react";
15 +import { unstable_useMemoCache as useMemoCache } from "react";
16 function Component(props) {
17 - const $ = React.unstable_useMemoCache(3);
17 + const $ = useMemoCache(3);
18 const c_0 = $[0] !== props.a;
19 const c_1 = $[1] !== props.b;
20 let t0;
compiler/forget/src/__tests__/fixtures/compiler/reactive-scope-grouping.expect.md
+2 -2
@@ -17,9 +17,9 @@ function foo() {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 function foo() {
22 - const $ = React.unstable_useMemoCache(3);
22 + const $ = useMemoCache(3);
23 let x;
24 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
25 x = {};
compiler/forget/src/__tests__/fixtures/compiler/reactive-scopes-if.expect.md
+2 -2
@@ -19,9 +19,9 @@ function foo(a, b, c) {
19 ## Code
20
21 ```javascript
22 -import * as React from "react";
22 +import { unstable_useMemoCache as useMemoCache } from "react";
23 function foo(a, b, c) {
24 - const $ = React.unstable_useMemoCache(8);
24 + const $ = useMemoCache(8);
25 const c_0 = $[0] !== a;
26 const c_1 = $[1] !== b;
27 const c_2 = $[2] !== c;
compiler/forget/src/__tests__/fixtures/compiler/reactive-scopes.expect.md
+2 -2
@@ -18,9 +18,9 @@ function f(a, b) {
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function f(a, b) {
23 - const $ = React.unstable_useMemoCache(5);
23 + const $ = useMemoCache(5);
24 const c_0 = $[0] !== a.length;
25 const c_1 = $[1] !== b;
26 let x;
compiler/forget/src/__tests__/fixtures/compiler/reactivity-analysis-interleaved-reactivity.expect.md
+2 -2
@@ -27,9 +27,9 @@ function Component(props) {
27 ## Code
28
29 ```javascript
30 -import * as React from "react";
30 +import { unstable_useMemoCache as useMemoCache } from "react";
31 function Component(props) {
32 - const $ = React.unstable_useMemoCache(6);
32 + const $ = useMemoCache(6);
33 const c_0 = $[0] !== props.b;
34 let a;
35 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/reactivity-analysis-reactive-via-mutation-of-computed-load.expect.md
+2 -2
@@ -16,9 +16,9 @@ function Component(props) {
16 ## Code
17
18 ```javascript
19 -import * as React from "react";
19 +import { unstable_useMemoCache as useMemoCache } from "react";
20 function Component(props) {
21 - const $ = React.unstable_useMemoCache(8);
21 + const $ = useMemoCache(8);
22 const c_0 = $[0] !== props.key;
23 const c_1 = $[1] !== props.a;
24 let items;
compiler/forget/src/__tests__/fixtures/compiler/reactivity-analysis-reactive-via-mutation-of-property-load.expect.md
+2 -2
@@ -16,9 +16,9 @@ function Component(props) {
16 ## Code
17
18 ```javascript
19 -import * as React from "react";
19 +import { unstable_useMemoCache as useMemoCache } from "react";
20 function Component(props) {
21 - const $ = React.unstable_useMemoCache(7);
21 + const $ = useMemoCache(7);
22 const c_0 = $[0] !== props.a;
23 let items;
24 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/reassigned-temporary-accessed-outside-scope.expect.md
+2 -2
@@ -13,9 +13,9 @@ function Component(props) {
13 ## Code
14
15 ```javascript
16 -import * as React from "react";
16 +import { unstable_useMemoCache as useMemoCache } from "react";
17 function Component(props) {
18 - const $ = React.unstable_useMemoCache(6);
18 + const $ = useMemoCache(6);
19 const c_0 = $[0] !== props.value;
20 let t0;
21 let t1;
compiler/forget/src/__tests__/fixtures/compiler/reassignment-conditional.expect.md
+2 -2
@@ -21,9 +21,9 @@ function Component(props) {
21 ## Code
22
23 ```javascript
24 -import * as React from "react";
24 +import { unstable_useMemoCache as useMemoCache } from "react";
25 function Component(props) {
26 - const $ = React.unstable_useMemoCache(9);
26 + const $ = useMemoCache(9);
27 const c_0 = $[0] !== props.p0;
28 const c_1 = $[1] !== props.p1;
29 const c_2 = $[2] !== props.p2;
compiler/forget/src/__tests__/fixtures/compiler/reassignment-separate-scopes.expect.md
+2 -2
@@ -33,9 +33,9 @@ function foo(a, b, c) {
33 ## Code
34
35 ```javascript
36 -import * as React from "react";
36 +import { unstable_useMemoCache as useMemoCache } from "react";
37 function foo(a, b, c) {
38 - const $ = React.unstable_useMemoCache(11);
38 + const $ = useMemoCache(11);
39 const c_0 = $[0] !== a;
40 let x;
41 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/reassignment.expect.md
+2 -2
@@ -20,9 +20,9 @@ function Component(props) {
20 ## Code
21
22 ```javascript
23 -import * as React from "react";
23 +import { unstable_useMemoCache as useMemoCache } from "react";
24 function Component(props) {
25 - const $ = React.unstable_useMemoCache(8);
25 + const $ = useMemoCache(8);
26 const c_0 = $[0] !== props.p0;
27 const c_1 = $[1] !== props.p1;
28 let x;
compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-condexpr.expect.md
+2 -2
@@ -16,12 +16,12 @@ function TestCondDepInConditionalExpr(props, other) {
16 ## Code
17
18 ```javascript
19 -import * as React from "react"; // props.a.b should be added as a unconditional dependency to the reactive
19 +import { unstable_useMemoCache as useMemoCache } from "react"; // props.a.b should be added as a unconditional dependency to the reactive
20 // scope that produces x, since it is accessed unconditionally in all cfg
21 // paths
22
23 function TestCondDepInConditionalExpr(props, other) {
24 - const $ = React.unstable_useMemoCache(3);
24 + const $ = useMemoCache(3);
25 const c_0 = $[0] !== other;
26 const c_1 = $[1] !== props.a.b;
27 let t0;
compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-ifelse.expect.md
+2 -2
@@ -21,12 +21,12 @@ function TestCondDepInDirectIfElse(props, other) {
21 ## Code
22
23 ```javascript
24 -import * as React from "react"; // props.a.b should be added as a unconditional dependency to the reactive
24 +import { unstable_useMemoCache as useMemoCache } from "react"; // props.a.b should be added as a unconditional dependency to the reactive
25 // scope that produces x, since it is accessed unconditionally in all cfg
26 // paths
27
28 function TestCondDepInDirectIfElse(props, other) {
29 - const $ = React.unstable_useMemoCache(3);
29 + const $ = useMemoCache(3);
30 const c_0 = $[0] !== other;
31 const c_1 = $[1] !== props.a.b;
32 let x;
compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-nested-ifelse-missing.expect.md
+2 -2
@@ -22,11 +22,11 @@ function TestCondDepInNestedIfElse(props, other) {
22 ## Code
23
24 ```javascript
25 -import * as React from "react"; // props.a.b should NOT be added as a unconditional dependency to the reactive
25 +import { unstable_useMemoCache as useMemoCache } from "react"; // props.a.b should NOT be added as a unconditional dependency to the reactive
26 // scope that produces x if it is not accessed in every path
27
28 function TestCondDepInNestedIfElse(props, other) {
29 - const $ = React.unstable_useMemoCache(3);
29 + const $ = useMemoCache(3);
30 const c_0 = $[0] !== other;
31 const c_1 = $[1] !== props;
32 let x;
compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-nested-ifelse.expect.md
+2 -2
@@ -27,12 +27,12 @@ function TestCondDepInNestedIfElse(props, other) {
27 ## Code
28
29 ```javascript
30 -import * as React from "react"; // props.a.b should be added as a unconditional dependency to the reactive
30 +import { unstable_useMemoCache as useMemoCache } from "react"; // props.a.b should be added as a unconditional dependency to the reactive
31 // scope that produces x, since it is accessed unconditionally in all cfg
32 // paths
33
34 function TestCondDepInNestedIfElse(props, other) {
35 - const $ = React.unstable_useMemoCache(3);
35 + const $ = useMemoCache(3);
36 const c_0 = $[0] !== other;
37 const c_1 = $[1] !== props.a.b;
38 let x;
compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-switch-missing-case.expect.md
+2 -2
@@ -26,11 +26,11 @@ function TestCondDepInSwitchMissingCase(props, other) {
26 ## Code
27
28 ```javascript
29 -import * as React from "react"; // props.a.b should NOT be added as a unconditional dependency to the reactive
29 +import { unstable_useMemoCache as useMemoCache } from "react"; // props.a.b should NOT be added as a unconditional dependency to the reactive
30 // scope that produces x if it is not accessed in every path
31
32 function TestCondDepInSwitchMissingCase(props, other) {
33 - const $ = React.unstable_useMemoCache(3);
33 + const $ = useMemoCache(3);
34 const c_0 = $[0] !== other;
35 const c_1 = $[1] !== props;
36 let x;
compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-switch-missing-default.expect.md
+2 -2
@@ -23,11 +23,11 @@ function TestCondDepInSwitchMissingDefault(props, other) {
23 ## Code
24
25 ```javascript
26 -import * as React from "react"; // props.a.b should NOT be added as a unconditional dependency to the reactive
26 +import { unstable_useMemoCache as useMemoCache } from "react"; // props.a.b should NOT be added as a unconditional dependency to the reactive
27 // scope that produces x if it is not accessed in the default case.
28
29 function TestCondDepInSwitchMissingDefault(props, other) {
30 - const $ = React.unstable_useMemoCache(3);
30 + const $ = useMemoCache(3);
31 const c_0 = $[0] !== other;
32 const c_1 = $[1] !== props;
33 let x;
compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-cfg-switch.expect.md
+2 -2
@@ -26,12 +26,12 @@ function TestCondDepInSwitch(props, other) {
26 ## Code
27
28 ```javascript
29 -import * as React from "react"; // props.a.b should be added as a unconditional dependency to the reactive
29 +import { unstable_useMemoCache as useMemoCache } from "react"; // props.a.b should be added as a unconditional dependency to the reactive
30 // scope that produces x, since it is accessed unconditionally in all cfg
31 // paths
32
33 function TestCondDepInSwitch(props, other) {
34 - const $ = React.unstable_useMemoCache(3);
34 + const $ = useMemoCache(3);
35 const c_0 = $[0] !== other;
36 const c_1 = $[1] !== props.a.b;
37 let x;
compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-no-uncond.expect.md
+2 -2
@@ -18,10 +18,10 @@ function TestOnlyConditionalDependencies(props, other) {
18 ## Code
19
20 ```javascript
21 -import * as React from "react"; // When an object's properties are only read conditionally, we should
21 +import { unstable_useMemoCache as useMemoCache } from "react"; // When an object's properties are only read conditionally, we should
22 // track the base object as a dependency.
23 function TestOnlyConditionalDependencies(props, other) {
24 - const $ = React.unstable_useMemoCache(3);
24 + const $ = useMemoCache(3);
25 const c_0 = $[0] !== other;
26 const c_1 = $[1] !== props;
27 let x;
compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-promote-uncond.expect.md
+2 -2
@@ -19,11 +19,11 @@ function TestPromoteUnconditionalAccessToDependency(props, other) {
19 ## Code
20
21 ```javascript
22 -import * as React from "react"; // When a conditional dependency `props.a.b.c` has no unconditional dependency
22 +import { unstable_useMemoCache as useMemoCache } from "react"; // When a conditional dependency `props.a.b.c` has no unconditional dependency
23 // in its subpath or superpath, we should find the nearest unconditional access
24 // and promote it to an unconditional dependency.
25 function TestPromoteUnconditionalAccessToDependency(props, other) {
26 - const $ = React.unstable_useMemoCache(3);
26 + const $ = useMemoCache(3);
27 const c_0 = $[0] !== props.a;
28 const c_1 = $[1] !== other;
29 let x;
compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-subpath-order1.expect.md
+2 -2
@@ -21,13 +21,13 @@ function TestConditionalSubpath1(props, other) {
21 ## Code
22
23 ```javascript
24 -import * as React from "react"; // When a conditional dependency `props.a` is a subpath of an unconditional
24 +import { unstable_useMemoCache as useMemoCache } from "react"; // When a conditional dependency `props.a` is a subpath of an unconditional
25 // dependency `props.a.b`, we can access `props.a` while preserving program
26 // semantics (with respect to nullthrows).
27 // deps: {`props.a`, `props.a.b`} can further reduce to just `props.a`
28 // ordering of accesses should not matter
29 function TestConditionalSubpath1(props, other) {
30 - const $ = React.unstable_useMemoCache(3);
30 + const $ = useMemoCache(3);
31 const c_0 = $[0] !== props.a;
32 const c_1 = $[1] !== other;
33 let x;
compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-subpath-order2.expect.md
+2 -2
@@ -21,13 +21,13 @@ function TestConditionalSubpath2(props, other) {
21 ## Code
22
23 ```javascript
24 -import * as React from "react"; // When a conditional dependency `props.a` is a subpath of an unconditional
24 +import { unstable_useMemoCache as useMemoCache } from "react"; // When a conditional dependency `props.a` is a subpath of an unconditional
25 // dependency `props.a.b`, we can access `props.a` while preserving program
26 // semantics (with respect to nullthrows).
27 // deps: {`props.a`, `props.a.b`} can further reduce to just `props.a`
28 // ordering of accesses should not matter
29 function TestConditionalSubpath2(props, other) {
30 - const $ = React.unstable_useMemoCache(3);
30 + const $ = useMemoCache(3);
31 const c_0 = $[0] !== other;
32 const c_1 = $[1] !== props.a;
33 let x;
compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-superpath-order1.expect.md
+2 -2
@@ -20,12 +20,12 @@ function TestConditionalSuperpath1(props, other) {
20 ## Code
21
22 ```javascript
23 -import * as React from "react"; // When an unconditional dependency `props.a` is the subpath of a conditional
23 +import { unstable_useMemoCache as useMemoCache } from "react"; // When an unconditional dependency `props.a` is the subpath of a conditional
24 // dependency `props.a.b`, we can safely overestimate and only track `props.a`
25 // as a dependency
26 // ordering of accesses should not matter
27 function TestConditionalSuperpath1(props, other) {
28 - const $ = React.unstable_useMemoCache(3);
28 + const $ = useMemoCache(3);
29 const c_0 = $[0] !== props.a;
30 const c_1 = $[1] !== other;
31 let x;
compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-deps-superpath-order2.expect.md
+2 -2
@@ -20,12 +20,12 @@ function TestConditionalSuperpath2(props, other) {
20 ## Code
21
22 ```javascript
23 -import * as React from "react"; // When an unconditional dependency `props.a` is the subpath of a conditional
23 +import { unstable_useMemoCache as useMemoCache } from "react"; // When an unconditional dependency `props.a` is the subpath of a conditional
24 // dependency `props.a.b`, we can safely overestimate and only track `props.a`
25 // as a dependency
26 // ordering of accesses should not matter
27 function TestConditionalSuperpath2(props, other) {
28 - const $ = React.unstable_useMemoCache(3);
28 + const $ = useMemoCache(3);
29 const c_0 = $[0] !== other;
30 const c_1 = $[1] !== props.a;
31 let x;
compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-cond-memberexpr-join.expect.md
+2 -2
@@ -25,7 +25,7 @@ function Component(props) {
25 ## Code
26
27 ```javascript
28 -import * as React from "react"; // To preserve the nullthrows behavior and reactive deps of this code,
28 +import { unstable_useMemoCache as useMemoCache } from "react"; // To preserve the nullthrows behavior and reactive deps of this code,
29 // Forget needs to add `props.a.b` or a subpath as a dependency.
30 //
31 // (1) Since the reactive block producing x unconditionally read props.a.<...>,
@@ -37,7 +37,7 @@ import * as React from "react"; // To preserve the nullthrows behavior and react
37 // we technically do not need to add `props.a` as a dependency.
38
39 function Component(props) {
40 - const $ = React.unstable_useMemoCache(2);
40 + const $ = useMemoCache(2);
41 const c_0 = $[0] !== props.a.b;
42 let x;
43 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-deps-cond-scope.expect.md
+2 -2
@@ -34,7 +34,7 @@ function TestReactiveDepsInCondScope(props) {
34 ## Code
35
36 ```javascript
37 -import * as React from "react"; // Some reactive scopes are created within a conditional. If a child scope
37 +import { unstable_useMemoCache as useMemoCache } from "react"; // Some reactive scopes are created within a conditional. If a child scope
38 // is within a conditional, its reactive dependencies should be propagated
39 // as conditionals
40 //
@@ -53,7 +53,7 @@ import * as React from "react"; // Some reactive scopes are created within a con
53 // ```
54
55 function TestReactiveDepsInCondScope(props) {
56 - const $ = React.unstable_useMemoCache(4);
56 + const $ = useMemoCache(4);
57 const c_0 = $[0] !== props;
58 let x;
59 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-deps-join-uncond-scopes-cond-deps.expect.md
+2 -2
@@ -34,7 +34,7 @@ function TestJoinCondDepsInUncondScopes(props) {
34 ## Code
35
36 ```javascript
37 -import * as React from "react"; // This tests an optimization, NOT a correctness property.
37 +import { unstable_useMemoCache as useMemoCache } from "react"; // This tests an optimization, NOT a correctness property.
38 // When propagating reactive dependencies of an inner scope up to its parent,
39 // we prefer to retain granularity.
40 //
@@ -52,7 +52,7 @@ import * as React from "react"; // This tests an optimization, NOT a correctness
52 // }
53
54 function TestJoinCondDepsInUncondScopes(props) {
55 - const $ = React.unstable_useMemoCache(8);
55 + const $ = useMemoCache(8);
56 const c_0 = $[0] !== props.a.b;
57 let x;
58 let y;
compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-nonoverlap-descendant.expect.md
+2 -2
@@ -17,10 +17,10 @@ function TestNonOverlappingDescendantTracked(props) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react"; // Test that we can track non-overlapping dependencies separately.
20 +import { unstable_useMemoCache as useMemoCache } from "react"; // Test that we can track non-overlapping dependencies separately.
21 // (not needed for correctness but for dependency granularity)
22 function TestNonOverlappingDescendantTracked(props) {
23 - const $ = React.unstable_useMemoCache(4);
23 + const $ = useMemoCache(4);
24 const c_0 = $[0] !== props.a.x.y;
25 const c_1 = $[1] !== props.a.c.x.y.z;
26 const c_2 = $[2] !== props.b;
compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-nonoverlap-direct.expect.md
+2 -2
@@ -16,10 +16,10 @@ function TestNonOverlappingTracked(props) {
16 ## Code
17
18 ```javascript
19 -import * as React from "react"; // Test that we can track non-overlapping dependencies separately.
19 +import { unstable_useMemoCache as useMemoCache } from "react"; // Test that we can track non-overlapping dependencies separately.
20 // (not needed for correctness but for dependency granularity)
21 function TestNonOverlappingTracked(props) {
22 - const $ = React.unstable_useMemoCache(3);
22 + const $ = useMemoCache(3);
23 const c_0 = $[0] !== props.a.b;
24 const c_1 = $[1] !== props.a.c;
25 let x;
compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-overlap-descendant.expect.md
+2 -2
@@ -17,10 +17,10 @@ function TestOverlappingDescendantTracked(props) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react"; // Test that we correctly track a subpath if the subpath itself is accessed as
20 +import { unstable_useMemoCache as useMemoCache } from "react"; // Test that we correctly track a subpath if the subpath itself is accessed as
21 // a dependency
22 function TestOverlappingDescendantTracked(props) {
23 - const $ = React.unstable_useMemoCache(2);
23 + const $ = useMemoCache(2);
24 const c_0 = $[0] !== props.a;
25 let x;
26 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-overlap-direct.expect.md
+2 -2
@@ -17,10 +17,10 @@ function TestOverlappingTracked(props) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react"; // Test that we correctly track a subpath if the subpath itself is accessed as
20 +import { unstable_useMemoCache as useMemoCache } from "react"; // Test that we correctly track a subpath if the subpath itself is accessed as
21 // a dependency
22 function TestOverlappingTracked(props) {
23 - const $ = React.unstable_useMemoCache(2);
23 + const $ = useMemoCache(2);
24 const c_0 = $[0] !== props.a;
25 let x;
26 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-subpath-order1.expect.md
+2 -2
@@ -17,10 +17,10 @@ function TestDepsSubpathOrder1(props) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react"; // Determine that we only need to track p.a here
20 +import { unstable_useMemoCache as useMemoCache } from "react"; // Determine that we only need to track p.a here
21 // Ordering of access should not matter
22 function TestDepsSubpathOrder1(props) {
23 - const $ = React.unstable_useMemoCache(2);
23 + const $ = useMemoCache(2);
24 const c_0 = $[0] !== props.a;
25 let x;
26 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-subpath-order2.expect.md
+2 -2
@@ -17,10 +17,10 @@ function TestDepsSubpathOrder2(props) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react"; // Determine that we only need to track p.a here
20 +import { unstable_useMemoCache as useMemoCache } from "react"; // Determine that we only need to track p.a here
21 // Ordering of access should not matter
22 function TestDepsSubpathOrder2(props) {
23 - const $ = React.unstable_useMemoCache(2);
23 + const $ = useMemoCache(2);
24 const c_0 = $[0] !== props.a;
25 let x;
26 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/reduce-reactive-uncond-deps-subpath-order3.expect.md
+2 -2
@@ -17,10 +17,10 @@ function TestDepsSubpathOrder3(props) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react"; // Determine that we only need to track p.a here
20 +import { unstable_useMemoCache as useMemoCache } from "react"; // Determine that we only need to track p.a here
21 // Ordering of access should not matter
22 function TestDepsSubpathOrder3(props) {
23 - const $ = React.unstable_useMemoCache(2);
23 + const $ = useMemoCache(2);
24 const c_0 = $[0] !== props.a;
25 let x;
26 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/regexp-literal.expect.md
+2 -2
@@ -18,9 +18,9 @@ function Component(props) {
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function Component(props) {
23 - const $ = React.unstable_useMemoCache(4);
23 + const $ = useMemoCache(4);
24 let t0;
25 let value;
26 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
compiler/forget/src/__tests__/fixtures/compiler/same-variable-as-dep-and-redeclare-maybe-frozen.expect.md
+2 -2
@@ -43,10 +43,10 @@ function foo(props) {
43 ## Code
44
45 ```javascript
46 -import * as React from "react"; // note: comments are for the ideal scopes, not what is currently
46 +import { unstable_useMemoCache as useMemoCache } from "react"; // note: comments are for the ideal scopes, not what is currently
47 // emitted
48 function foo(props) {
49 - const $ = React.unstable_useMemoCache(16);
49 + const $ = useMemoCache(16);
50 const c_0 = $[0] !== props.a;
51 let x;
52 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/same-variable-as-dep-and-redeclare.expect.md
+2 -2
@@ -43,10 +43,10 @@ function foo(props) {
43 ## Code
44
45 ```javascript
46 -import * as React from "react"; // note: comments are for the ideal scopes, not what is currently
46 +import { unstable_useMemoCache as useMemoCache } from "react"; // note: comments are for the ideal scopes, not what is currently
47 // emitted
48 function foo(props) {
49 - const $ = React.unstable_useMemoCache(15);
49 + const $ = useMemoCache(15);
50 const c_0 = $[0] !== props.a;
51 let x;
52 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/sequence-expression.expect.md
+2 -2
@@ -17,9 +17,9 @@ function foo() {}
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 function sequence(props) {
22 - const $ = React.unstable_useMemoCache(2);
22 + const $ = useMemoCache(2);
23 Math.max(1, 2);
24 let t0;
25 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
compiler/forget/src/__tests__/fixtures/compiler/simple-alias.expect.md
+2 -2
@@ -19,10 +19,10 @@ function foo() {
19 ## Code
20
21 ```javascript
22 -import * as React from "react";
22 +import { unstable_useMemoCache as useMemoCache } from "react";
23 function mutate() {}
24 function foo() {
25 - const $ = React.unstable_useMemoCache(1);
25 + const $ = useMemoCache(1);
26 let c;
27 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
28 let b = {};
compiler/forget/src/__tests__/fixtures/compiler/simple-function-1.expect.md
+2 -2
@@ -14,9 +14,9 @@ function component() {
14 ## Code
15
16 ```javascript
17 -import * as React from "react";
17 +import { unstable_useMemoCache as useMemoCache } from "react";
18 function component() {
19 - const $ = React.unstable_useMemoCache(1);
19 + const $ = useMemoCache(1);
20 let t0;
21 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
22 t0 = function (a) {
compiler/forget/src/__tests__/fixtures/compiler/simple-scope.expect.md
+2 -2
@@ -12,9 +12,9 @@ function foo(a) {
12 ## Code
13
14 ```javascript
15 -import * as React from "react";
15 +import { unstable_useMemoCache as useMemoCache } from "react";
16 function foo(a) {
17 - const $ = React.unstable_useMemoCache(2);
17 + const $ = useMemoCache(2);
18 const c_0 = $[0] !== a.b;
19 let t0;
20 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/simple.expect.md
+2 -2
@@ -14,9 +14,9 @@ export default function foo(x, y) {
14 ## Code
15
16 ```javascript
17 -import * as React from "react";
17 +import { unstable_useMemoCache as useMemoCache } from "react";
18 export default function foo(x, y) {
19 - const $ = React.unstable_useMemoCache(4);
19 + const $ = useMemoCache(4);
20 if (x) {
21 const c_0 = $[0] !== y;
22 let t0;
compiler/forget/src/__tests__/fixtures/compiler/ssa-arrayexpression.expect.md
+2 -2
@@ -14,9 +14,9 @@ function Component(props) {
14 ## Code
15
16 ```javascript
17 -import * as React from "react";
17 +import { unstable_useMemoCache as useMemoCache } from "react";
18 function Component(props) {
19 - const $ = React.unstable_useMemoCache(1);
19 + const $ = useMemoCache(1);
20 let t0;
21 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
22 t0 = [1, 2];
compiler/forget/src/__tests__/fixtures/compiler/ssa-call-jsx-2.expect.md
+2 -2
@@ -21,11 +21,11 @@ function Component(props) {
21 ## Code
22
23 ```javascript
24 -import * as React from "react"; // @Pass runMutableRangeAnalysis
24 +import { unstable_useMemoCache as useMemoCache } from "react"; // @Pass runMutableRangeAnalysis
25 function foo() {}
26
27 function Component(props) {
28 - const $ = React.unstable_useMemoCache(3);
28 + const $ = useMemoCache(3);
29 let a;
30 let b;
31 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
compiler/forget/src/__tests__/fixtures/compiler/ssa-call-jsx.expect.md
+2 -2
@@ -18,11 +18,11 @@ function Component(props) {
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function foo() {}
23
24 function Component(props) {
25 - const $ = React.unstable_useMemoCache(3);
25 + const $ = useMemoCache(3);
26 let a;
27 let b;
28 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
compiler/forget/src/__tests__/fixtures/compiler/ssa-cascading-eliminated-phis.expect.md
+2 -2
@@ -23,9 +23,9 @@ function Component(props) {
23 ## Code
24
25 ```javascript
26 -import * as React from "react";
26 +import { unstable_useMemoCache as useMemoCache } from "react";
27 function Component(props) {
28 - const $ = React.unstable_useMemoCache(2);
28 + const $ = useMemoCache(2);
29 let x = 0;
30 const c_0 = $[0] !== props;
31 let values;
compiler/forget/src/__tests__/fixtures/compiler/ssa-for-of.expect.md
+2 -2
@@ -18,9 +18,9 @@ function foo(cond) {
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function foo(cond) {
23 - const $ = React.unstable_useMemoCache(1);
23 + const $ = useMemoCache(1);
24 let t0;
25 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
26 t0 = [];
compiler/forget/src/__tests__/fixtures/compiler/ssa-leave-case.expect.md
+2 -2
@@ -22,9 +22,9 @@ function Component(props) {
22 ## Code
23
24 ```javascript
25 -import * as React from "react";
25 +import { unstable_useMemoCache as useMemoCache } from "react";
26 function Component(props) {
27 - const $ = React.unstable_useMemoCache(6);
27 + const $ = useMemoCache(6);
28 const c_0 = $[0] !== props;
29 let x;
30 let y;
compiler/forget/src/__tests__/fixtures/compiler/ssa-newexpression.expect.md
+2 -2
@@ -16,11 +16,11 @@ function Component(props) {
16 ## Code
17
18 ```javascript
19 -import * as React from "react";
19 +import { unstable_useMemoCache as useMemoCache } from "react";
20 function Foo() {}
21
22 function Component(props) {
23 - const $ = React.unstable_useMemoCache(1);
23 + const $ = useMemoCache(1);
24 let t0;
25 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
26 const a = [];
compiler/forget/src/__tests__/fixtures/compiler/ssa-non-empty-initializer.expect.md
+2 -2
@@ -17,9 +17,9 @@ function foo(a, b) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 function foo(a, b) {
22 - const $ = React.unstable_useMemoCache(1);
22 + const $ = useMemoCache(1);
23 let t0;
24 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
25 t0 = [];
compiler/forget/src/__tests__/fixtures/compiler/ssa-objectexpression-phi.expect.md
+2 -2
@@ -21,9 +21,9 @@ function foo() {
21 ## Code
22
23 ```javascript
24 -import * as React from "react";
24 +import { unstable_useMemoCache as useMemoCache } from "react";
25 function foo() {
26 - const $ = React.unstable_useMemoCache(1);
26 + const $ = useMemoCache(1);
27 const x = 1;
28
29 const y = 3;
compiler/forget/src/__tests__/fixtures/compiler/ssa-objectexpression.expect.md
+2 -2
@@ -14,9 +14,9 @@ function Component(props) {
14 ## Code
15
16 ```javascript
17 -import * as React from "react";
17 +import { unstable_useMemoCache as useMemoCache } from "react";
18 function Component(props) {
19 - const $ = React.unstable_useMemoCache(1);
19 + const $ = useMemoCache(1);
20 let t0;
21 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
22 t0 = { a: 1, b: 2 };
compiler/forget/src/__tests__/fixtures/compiler/ssa-property-alias-alias-mutate-if.expect.md
+2 -2
@@ -21,9 +21,9 @@ function foo(a) {
21 ## Code
22
23 ```javascript
24 -import * as React from "react";
24 +import { unstable_useMemoCache as useMemoCache } from "react";
25 function foo(a) {
26 - const $ = React.unstable_useMemoCache(2);
26 + const $ = useMemoCache(2);
27 const c_0 = $[0] !== a;
28 let x;
29 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/ssa-property-alias-if.expect.md
+2 -2
@@ -19,9 +19,9 @@ function foo(a) {
19 ## Code
20
21 ```javascript
22 -import * as React from "react";
22 +import { unstable_useMemoCache as useMemoCache } from "react";
23 function foo(a) {
24 - const $ = React.unstable_useMemoCache(4);
24 + const $ = useMemoCache(4);
25 const c_0 = $[0] !== a;
26 let x;
27 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/ssa-property-alias-mutate-if.expect.md
+2 -2
@@ -20,9 +20,9 @@ function foo(a) {
20 ## Code
21
22 ```javascript
23 -import * as React from "react";
23 +import { unstable_useMemoCache as useMemoCache } from "react";
24 function foo(a) {
25 - const $ = React.unstable_useMemoCache(2);
25 + const $ = useMemoCache(2);
26 const c_0 = $[0] !== a;
27 let x;
28 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/ssa-property-alias-mutate-inside-if.expect.md
+2 -2
@@ -20,9 +20,9 @@ function foo(a) {
20 ## Code
21
22 ```javascript
23 -import * as React from "react";
23 +import { unstable_useMemoCache as useMemoCache } from "react";
24 function foo(a) {
25 - const $ = React.unstable_useMemoCache(3);
25 + const $ = useMemoCache(3);
26 const c_0 = $[0] !== a;
27 let x;
28 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/ssa-property-alias-mutate.expect.md
+2 -2
@@ -18,9 +18,9 @@ function foo() {
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function foo() {
23 - const $ = React.unstable_useMemoCache(1);
23 + const $ = useMemoCache(1);
24 let y;
25 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
26 const a = {};
compiler/forget/src/__tests__/fixtures/compiler/ssa-property-call.expect.md
+2 -2
@@ -14,9 +14,9 @@ function foo() {
14 ## Code
15
16 ```javascript
17 -import * as React from "react";
17 +import { unstable_useMemoCache as useMemoCache } from "react";
18 function foo() {
19 - const $ = React.unstable_useMemoCache(1);
19 + const $ = useMemoCache(1);
20 let y;
21 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
22 const x = [];
compiler/forget/src/__tests__/fixtures/compiler/ssa-property-mutate-2.expect.md
+2 -2
@@ -15,9 +15,9 @@ function foo() {
15 ## Code
16
17 ```javascript
18 -import * as React from "react";
18 +import { unstable_useMemoCache as useMemoCache } from "react";
19 function foo() {
20 - const $ = React.unstable_useMemoCache(1);
20 + const $ = useMemoCache(1);
21 let y;
22 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
23 const x = [];
compiler/forget/src/__tests__/fixtures/compiler/ssa-property-mutate-alias.expect.md
+2 -2
@@ -18,9 +18,9 @@ function foo() {
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function foo() {
23 - const $ = React.unstable_useMemoCache(1);
23 + const $ = useMemoCache(1);
24 let y;
25 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
26 const a = {};
compiler/forget/src/__tests__/fixtures/compiler/ssa-property-mutate.expect.md
+2 -2
@@ -15,9 +15,9 @@ function foo() {
15 ## Code
16
17 ```javascript
18 -import * as React from "react";
18 +import { unstable_useMemoCache as useMemoCache } from "react";
19 function foo() {
20 - const $ = React.unstable_useMemoCache(1);
20 + const $ = useMemoCache(1);
21 let y;
22 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
23 const x = [];
compiler/forget/src/__tests__/fixtures/compiler/ssa-property.expect.md
+2 -2
@@ -14,9 +14,9 @@ function foo() {
14 ## Code
15
16 ```javascript
17 -import * as React from "react";
17 +import { unstable_useMemoCache as useMemoCache } from "react";
18 function foo() {
19 - const $ = React.unstable_useMemoCache(2);
19 + const $ = useMemoCache(2);
20 let t0;
21 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
22 t0 = [];
compiler/forget/src/__tests__/fixtures/compiler/ssa-reassign-in-rval.expect.md
+2 -2
@@ -14,9 +14,9 @@ function Component() {
14 ## Code
15
16 ```javascript
17 -import * as React from "react"; // Forget should call the original x (x = foo()) to compute result
17 +import { unstable_useMemoCache as useMemoCache } from "react"; // Forget should call the original x (x = foo()) to compute result
18 function Component() {
19 - const $ = React.unstable_useMemoCache(3);
19 + const $ = useMemoCache(3);
20 let t0;
21 let x;
22 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-ternary-destruction-with-mutation.expect.md
+2 -2
@@ -18,9 +18,9 @@ function foo(props) {
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function foo(props) {
23 - const $ = React.unstable_useMemoCache(2);
23 + const $ = useMemoCache(2);
24 const c_0 = $[0] !== props;
25 let x;
26 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-ternary-destruction.expect.md
+2 -2
@@ -17,9 +17,9 @@ function foo(props) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 function foo(props) {
22 - const $ = React.unstable_useMemoCache(4);
22 + const $ = useMemoCache(4);
23 const c_0 = $[0] !== props.bar;
24 let x;
25 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-ternary-with-mutation.expect.md
+2 -2
@@ -16,9 +16,9 @@ function foo(props) {
16 ## Code
17
18 ```javascript
19 -import * as React from "react";
19 +import { unstable_useMemoCache as useMemoCache } from "react";
20 function foo(props) {
21 - const $ = React.unstable_useMemoCache(2);
21 + const $ = useMemoCache(2);
22 const c_0 = $[0] !== props;
23 let x;
24 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-ternary.expect.md
+2 -2
@@ -15,9 +15,9 @@ function foo(props) {
15 ## Code
16
17 ```javascript
18 -import * as React from "react";
18 +import { unstable_useMemoCache as useMemoCache } from "react";
19 function foo(props) {
20 - const $ = React.unstable_useMemoCache(4);
20 + const $ = useMemoCache(4);
21 const c_0 = $[0] !== props.bar;
22 let x;
23 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-unconditional-ternary-with-mutation.expect.md
+2 -2
@@ -18,9 +18,9 @@ function foo(props) {
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function foo(props) {
23 - const $ = React.unstable_useMemoCache(2);
23 + const $ = useMemoCache(2);
24 const c_0 = $[0] !== props;
25 let x;
26 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-unconditional-ternary.expect.md
+2 -2
@@ -17,9 +17,9 @@ function foo(props) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 function foo(props) {
22 - const $ = React.unstable_useMemoCache(4);
22 + const $ = useMemoCache(4);
23 const c_0 = $[0] !== props.bar;
24 let x;
25 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-unconditional-with-mutation.expect.md
+2 -2
@@ -23,9 +23,9 @@ function foo(props) {
23 ## Code
24
25 ```javascript
26 -import * as React from "react";
26 +import { unstable_useMemoCache as useMemoCache } from "react";
27 function foo(props) {
28 - const $ = React.unstable_useMemoCache(2);
28 + const $ = useMemoCache(2);
29 const c_0 = $[0] !== props;
30 let x;
31 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-via-destructuring-with-mutation.expect.md
+2 -2
@@ -19,9 +19,9 @@ function foo(props) {
19 ## Code
20
21 ```javascript
22 -import * as React from "react";
22 +import { unstable_useMemoCache as useMemoCache } from "react";
23 function foo(props) {
24 - const $ = React.unstable_useMemoCache(2);
24 + const $ = useMemoCache(2);
25 const c_0 = $[0] !== props;
26 let x;
27 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-via-destructuring.expect.md
+2 -2
@@ -18,9 +18,9 @@ function foo(props) {
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function foo(props) {
23 - const $ = React.unstable_useMemoCache(4);
23 + const $ = useMemoCache(4);
24 const c_0 = $[0] !== props.bar;
25 let x;
26 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming-with-mutation.expect.md
+2 -2
@@ -19,9 +19,9 @@ function foo(props) {
19 ## Code
20
21 ```javascript
22 -import * as React from "react";
22 +import { unstable_useMemoCache as useMemoCache } from "react";
23 function foo(props) {
24 - const $ = React.unstable_useMemoCache(2);
24 + const $ = useMemoCache(2);
25 const c_0 = $[0] !== props;
26 let x;
27 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/ssa-renaming.expect.md
+2 -2
@@ -18,9 +18,9 @@ function foo(props) {
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function foo(props) {
23 - const $ = React.unstable_useMemoCache(4);
23 + const $ = useMemoCache(4);
24 const c_0 = $[0] !== props.bar;
25 let x;
26 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/store-via-call.expect.md
+2 -2
@@ -14,9 +14,9 @@ function foo() {
14 ## Code
15
16 ```javascript
17 -import * as React from "react";
17 +import { unstable_useMemoCache as useMemoCache } from "react";
18 function foo() {
19 - const $ = React.unstable_useMemoCache(1);
19 + const $ = useMemoCache(1);
20 let x;
21 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
22 x = {};
compiler/forget/src/__tests__/fixtures/compiler/store-via-new.expect.md
+2 -2
@@ -14,9 +14,9 @@ function Foo() {
14 ## Code
15
16 ```javascript
17 -import * as React from "react";
17 +import { unstable_useMemoCache as useMemoCache } from "react";
18 function Foo() {
19 - const $ = React.unstable_useMemoCache(1);
19 + const $ = useMemoCache(1);
20 let x;
21 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
22 x = {};
compiler/forget/src/__tests__/fixtures/compiler/switch-non-final-default.expect.md
+2 -2
@@ -31,9 +31,9 @@ function Component(props) {
31 ## Code
32
33 ```javascript
34 -import * as React from "react";
34 +import { unstable_useMemoCache as useMemoCache } from "react";
35 function Component(props) {
36 - const $ = React.unstable_useMemoCache(9);
36 + const $ = useMemoCache(9);
37 const c_0 = $[0] !== props;
38 let x;
39 let y;
compiler/forget/src/__tests__/fixtures/compiler/switch.expect.md
+2 -2
@@ -26,9 +26,9 @@ function Component(props) {
26 ## Code
27
28 ```javascript
29 -import * as React from "react";
29 +import { unstable_useMemoCache as useMemoCache } from "react";
30 function Component(props) {
31 - const $ = React.unstable_useMemoCache(8);
31 + const $ = useMemoCache(8);
32 const c_0 = $[0] !== props;
33 let x;
34 let y;
compiler/forget/src/__tests__/fixtures/compiler/tagged-template-literal.expect.md
+2 -2
@@ -24,9 +24,9 @@ function component() {
24 ## Code
25
26 ```javascript
27 -import * as React from "react";
27 +import { unstable_useMemoCache as useMemoCache } from "react";
28 function component() {
29 - const $ = React.unstable_useMemoCache(1);
29 + const $ = useMemoCache(1);
30 let t0;
31 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
32 t0 = graphql`
compiler/forget/src/__tests__/fixtures/compiler/temporary-at-start-of-value-block.expect.md
+2 -2
@@ -13,9 +13,9 @@ function component(props) {
13 ## Code
14
15 ```javascript
16 -import * as React from "react";
16 +import { unstable_useMemoCache as useMemoCache } from "react";
17 function component(props) {
18 - const $ = React.unstable_useMemoCache(2);
18 + const $ = useMemoCache(2);
19 const c_0 = $[0] !== props;
20 let t0;
21 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/timers.expect.md
+2 -2
@@ -18,9 +18,9 @@ function Component(props) {
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function Component(props) {
23 - const $ = React.unstable_useMemoCache(2);
23 + const $ = useMemoCache(2);
24 const start = performance.now();
25 let t0;
26 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
compiler/forget/src/__tests__/fixtures/compiler/type-cast-expression.flow.expect.md
+2 -2
@@ -16,10 +16,10 @@ function Component(props) {
16 ## Code
17
18 ```javascript
19 -import * as React from "react"; // @flow
19 +import { unstable_useMemoCache as useMemoCache } from "react"; // @flow
20 type Foo = { bar: string };
21 function Component(props) {
22 - const $ = React.unstable_useMemoCache(2);
22 + const $ = useMemoCache(2);
23 const c_0 = $[0] !== props.bar;
24 let y;
25 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/type-field-load.expect.md
+2 -2
@@ -13,9 +13,9 @@ function component() {
13 ## Code
14
15 ```javascript
16 -import * as React from "react";
16 +import { unstable_useMemoCache as useMemoCache } from "react";
17 function component() {
18 - const $ = React.unstable_useMemoCache(1);
18 + const $ = useMemoCache(1);
19 let t0;
20 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
21 t0 = { t: 1 };
compiler/forget/src/__tests__/fixtures/compiler/type-test-field-load-binary-op.expect.md
+2 -2
@@ -19,9 +19,9 @@ function component() {
19 ## Code
20
21 ```javascript
22 -import * as React from "react";
22 +import { unstable_useMemoCache as useMemoCache } from "react";
23 function component() {
24 - const $ = React.unstable_useMemoCache(3);
24 + const $ = useMemoCache(3);
25 let t0;
26 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
27 t0 = makeSomePrimitive();
compiler/forget/src/__tests__/fixtures/compiler/type-test-field-store.expect.md
+2 -2
@@ -15,9 +15,9 @@ function component() {
15 ## Code
16
17 ```javascript
18 -import * as React from "react";
18 +import { unstable_useMemoCache as useMemoCache } from "react";
19 function component() {
20 - const $ = React.unstable_useMemoCache(2);
20 + const $ = useMemoCache(2);
21 let x;
22 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
23 x = {};
compiler/forget/src/__tests__/fixtures/compiler/type-test-polymorphic.expect.md
+2 -2
@@ -22,9 +22,9 @@ function component() {
22 ## Code
23
24 ```javascript
25 -import * as React from "react";
25 +import { unstable_useMemoCache as useMemoCache } from "react";
26 function component() {
27 - const $ = React.unstable_useMemoCache(3);
27 + const $ = useMemoCache(3);
28 let t0;
29 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
30 t0 = makePrimitive();
compiler/forget/src/__tests__/fixtures/compiler/type-test-return-type-inference.expect.md
+2 -2
@@ -18,9 +18,9 @@ function component() {
18 ## Code
19
20 ```javascript
21 -import * as React from "react";
21 +import { unstable_useMemoCache as useMemoCache } from "react";
22 function component() {
23 - const $ = React.unstable_useMemoCache(1);
23 + const $ = useMemoCache(1);
24 const x = foo();
25 const y = foo();
26 if (x > y) {
compiler/forget/src/__tests__/fixtures/compiler/unary-expr.expect.md
+2 -2
@@ -19,9 +19,9 @@ function component(a) {
19 ## Code
20
21 ```javascript
22 -import * as React from "react";
22 +import { unstable_useMemoCache as useMemoCache } from "react";
23 function component(a) {
24 - const $ = React.unstable_useMemoCache(8);
24 + const $ = useMemoCache(8);
25 const t = { t: a };
26 const z = +t.t;
27 const q = -t.t;
compiler/forget/src/__tests__/fixtures/compiler/unused-object-element-with-rest.expect.md
+2 -2
@@ -13,9 +13,9 @@ function Foo(props) {
13 ## Code
14
15 ```javascript
16 -import * as React from "react";
16 +import { unstable_useMemoCache as useMemoCache } from "react";
17 function Foo(props) {
18 - const $ = React.unstable_useMemoCache(2);
18 + const $ = useMemoCache(2);
19 const c_0 = $[0] !== props.a;
20 let rest;
21 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/update-expression.expect.md
+2 -2
@@ -14,9 +14,9 @@ function foo(props) {
14 ## Code
15
16 ```javascript
17 -import * as React from "react";
17 +import { unstable_useMemoCache as useMemoCache } from "react";
18 function foo(props) {
19 - const $ = React.unstable_useMemoCache(4);
19 + const $ = useMemoCache(4);
20 let x = props.x;
21 x = x + 1;
22 const y = x;
compiler/forget/src/__tests__/fixtures/compiler/use-callback-simple.expect.md
+2 -2
@@ -14,9 +14,9 @@ function component() {
14 ## Code
15
16 ```javascript
17 -import * as React from "react";
17 +import { unstable_useMemoCache as useMemoCache } from "react";
18 function component() {
19 - const $ = React.unstable_useMemoCache(5);
19 + const $ = useMemoCache(5);
20 const [count, setCount] = useState(0);
21 const c_0 = $[0] !== setCount;
22 const c_1 = $[1] !== count;
compiler/forget/src/__tests__/fixtures/compiler/useEffect-arg-memoized.expect.md
+2 -2
@@ -24,9 +24,9 @@ function Component(props) {
24 ## Code
25
26 ```javascript
27 -import * as React from "react";
27 +import { unstable_useMemoCache as useMemoCache } from "react";
28 function Component(props) {
29 - const $ = React.unstable_useMemoCache(7);
29 + const $ = useMemoCache(7);
30 const dispatch = useDispatch();
31 useFreeze(dispatch);
32 const c_0 = $[0] !== dispatch;
compiler/forget/src/__tests__/fixtures/compiler/useEffect-nested-lambdas.expect.md
+2 -2
@@ -30,9 +30,9 @@ function Component(props) {
30 ## Code
31
32 ```javascript
33 -import * as React from "react";
33 +import { unstable_useMemoCache as useMemoCache } from "react";
34 function Component(props) {
35 - const $ = React.unstable_useMemoCache(3);
35 + const $ = useMemoCache(3);
36 const item = useMutable(props.itemId);
37 const dispatch = useDispatch();
38 useFreeze(dispatch);
compiler/forget/src/__tests__/fixtures/compiler/useMemo-if-else-multiple-return.expect.md
+2 -2
@@ -17,9 +17,9 @@ function Component(props) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 function Component(props) {
22 - const $ = React.unstable_useMemoCache(4);
22 + const $ = useMemoCache(4);
23 let t17 = undefined;
24 if (props.cond) {
25 const c_0 = $[0] !== props.a;
compiler/forget/src/__tests__/fixtures/compiler/useMemo-independently-memoizeable.expect.md
+2 -2
@@ -17,9 +17,9 @@ function Component(props) {
17 ## Code
18
19 ```javascript
20 -import * as React from "react";
20 +import { unstable_useMemoCache as useMemoCache } from "react";
21 function Component(props) {
22 - const $ = React.unstable_useMemoCache(10);
22 + const $ = useMemoCache(10);
23 const c_0 = $[0] !== props.a;
24 let t0;
25 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/useMemo-inlining-block-return.expect.md
+2 -2
@@ -16,9 +16,9 @@ function component(a, b) {
16 ## Code
17
18 ```javascript
19 -import * as React from "react";
19 +import { unstable_useMemoCache as useMemoCache } from "react";
20 function component(a, b) {
21 - const $ = React.unstable_useMemoCache(2);
21 + const $ = useMemoCache(2);
22 let t14 = undefined;
23 if (a) {
24 const c_0 = $[0] !== b;
compiler/forget/src/__tests__/fixtures/compiler/useMemo-multiple-if-else.expect.md
+2 -2
@@ -22,9 +22,9 @@ function Component(props) {
22 ## Code
23
24 ```javascript
25 -import * as React from "react";
25 +import { unstable_useMemoCache as useMemoCache } from "react";
26 function Component(props) {
27 - const $ = React.unstable_useMemoCache(2);
27 + const $ = useMemoCache(2);
28 const c_0 = $[0] !== props;
29 let t26;
30 if (c_0) {
compiler/forget/src/__tests__/fixtures/compiler/useMemo-simple.expect.md
+2 -2
@@ -12,9 +12,9 @@ function component(a) {
12 ## Code
13
14 ```javascript
15 -import * as React from "react";
15 +import { unstable_useMemoCache as useMemoCache } from "react";
16 function component(a) {
17 - const $ = React.unstable_useMemoCache(4);
17 + const $ = useMemoCache(4);
18 const c_0 = $[0] !== a;
19 let t0;
20 if (c_0) {
compiler/forget/src/__tests__/fixtures/disableMemoizeJsxElements/Component.expect.md
+2 -2
@@ -19,9 +19,9 @@ function Component(props) {
19 ## Code
20
21 ```javascript
22 -import * as React from "react";
22 +import { unstable_useMemoCache as useMemoCache } from "react";
23 function Component(props) {
24 - const $ = React.unstable_useMemoCache(2);
24 + const $ = useMemoCache(2);
25 const [name, setName] = useState(null);
26 const c_0 = $[0] !== setName;
27 let t0;