mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Merge 0f12ec0881 into sapling-pr-archive-mofeiZ
This commit is contained in:
+50
@@ -0,0 +1,50 @@
|
||||
|
||||
## Input
|
||||
|
||||
```javascript
|
||||
// @dynamicGating:{"source":"shared-runtime"} @compilationMode:"annotation"
|
||||
|
||||
function Foo() {
|
||||
'use memo if(getTrue)';
|
||||
return <div>hello world</div>;
|
||||
}
|
||||
|
||||
export const FIXTURE_ENTRYPOINT = {
|
||||
fn: Foo,
|
||||
params: [{}],
|
||||
};
|
||||
|
||||
```
|
||||
|
||||
## Code
|
||||
|
||||
```javascript
|
||||
import { c as _c } from "react/compiler-runtime";
|
||||
import { getTrue } from "shared-runtime"; // @dynamicGating:{"source":"shared-runtime"} @compilationMode:"annotation"
|
||||
const Foo = getTrue()
|
||||
? function Foo() {
|
||||
"use memo if(getTrue)";
|
||||
const $ = _c(1);
|
||||
let t0;
|
||||
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
||||
t0 = <div>hello world</div>;
|
||||
$[0] = t0;
|
||||
} else {
|
||||
t0 = $[0];
|
||||
}
|
||||
return t0;
|
||||
}
|
||||
: function Foo() {
|
||||
"use memo if(getTrue)";
|
||||
return <div>hello world</div>;
|
||||
};
|
||||
|
||||
export const FIXTURE_ENTRYPOINT = {
|
||||
fn: Foo,
|
||||
params: [{}],
|
||||
};
|
||||
|
||||
```
|
||||
|
||||
### Eval output
|
||||
(kind: ok) <div>hello world</div>
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// @dynamicGating:{"source":"shared-runtime"} @compilationMode:"annotation"
|
||||
|
||||
function Foo() {
|
||||
'use memo if(getTrue)';
|
||||
return <div>hello world</div>;
|
||||
}
|
||||
|
||||
export const FIXTURE_ENTRYPOINT = {
|
||||
fn: Foo,
|
||||
params: [{}],
|
||||
};
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
|
||||
## Input
|
||||
|
||||
```javascript
|
||||
// @dynamicGating:{"source":"shared-runtime"} @noEmit
|
||||
|
||||
function Foo() {
|
||||
'use memo if(getTrue)';
|
||||
return <div>hello world</div>;
|
||||
}
|
||||
|
||||
export const FIXTURE_ENTRYPOINT = {
|
||||
fn: Foo,
|
||||
params: [{}],
|
||||
};
|
||||
|
||||
```
|
||||
|
||||
## Code
|
||||
|
||||
```javascript
|
||||
// @dynamicGating:{"source":"shared-runtime"} @noEmit
|
||||
|
||||
function Foo() {
|
||||
"use memo if(getTrue)";
|
||||
return <div>hello world</div>;
|
||||
}
|
||||
|
||||
export const FIXTURE_ENTRYPOINT = {
|
||||
fn: Foo,
|
||||
params: [{}],
|
||||
};
|
||||
|
||||
```
|
||||
|
||||
### Eval output
|
||||
(kind: ok) <div>hello world</div>
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// @dynamicGating:{"source":"shared-runtime"} @noEmit
|
||||
|
||||
function Foo() {
|
||||
'use memo if(getTrue)';
|
||||
return <div>hello world</div>;
|
||||
}
|
||||
|
||||
export const FIXTURE_ENTRYPOINT = {
|
||||
fn: Foo,
|
||||
params: [{}],
|
||||
};
|
||||
Reference in New Issue
Block a user