mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
test case for debugger stmt in reactive scope
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
|
||||
## Input
|
||||
|
||||
```javascript
|
||||
function Component(props) {
|
||||
const x = [];
|
||||
debugger;
|
||||
x.push(props.value);
|
||||
return x;
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Code
|
||||
|
||||
```javascript
|
||||
import { unstable_useMemoCache as useMemoCache } from "react";
|
||||
function Component(props) {
|
||||
const $ = useMemoCache(2);
|
||||
const c_0 = $[0] !== props.value;
|
||||
let x;
|
||||
if (c_0) {
|
||||
x = [];
|
||||
debugger;
|
||||
|
||||
x.push(props.value);
|
||||
$[0] = props.value;
|
||||
$[1] = x;
|
||||
} else {
|
||||
x = $[1];
|
||||
}
|
||||
return x;
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
function Component(props) {
|
||||
const x = [];
|
||||
debugger;
|
||||
x.push(props.value);
|
||||
return x;
|
||||
}
|
||||
Reference in New Issue
Block a user