mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[repro] add fixture repro for destructuring bug
This commit is contained in:
+51
@@ -0,0 +1,51 @@
|
||||
|
||||
## Input
|
||||
|
||||
```javascript
|
||||
function Component(props) {
|
||||
const {
|
||||
x: { destructured },
|
||||
sameName: renamed,
|
||||
} = props;
|
||||
const sameName = foo(destructured);
|
||||
|
||||
return [sameName, renamed];
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Code
|
||||
|
||||
```javascript
|
||||
import { unstable_useMemoCache as useMemoCache } from "react";
|
||||
function Component(props) {
|
||||
const $ = useMemoCache(6);
|
||||
let sameName;
|
||||
let renamed;
|
||||
if ($[0] !== props) {
|
||||
const { x: t20, sameName: t32 } = props;
|
||||
renamed = t32;
|
||||
sameName = foo(destructured);
|
||||
$[0] = props;
|
||||
$[1] = sameName;
|
||||
$[2] = renamed;
|
||||
} else {
|
||||
sameName = $[1];
|
||||
renamed = $[2];
|
||||
}
|
||||
|
||||
const t0 = sameName;
|
||||
let t1;
|
||||
if ($[3] !== t0 || $[4] !== renamed) {
|
||||
t1 = [t0, renamed];
|
||||
$[3] = t0;
|
||||
$[4] = renamed;
|
||||
$[5] = t1;
|
||||
} else {
|
||||
t1 = $[5];
|
||||
}
|
||||
return t1;
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
function Component(props) {
|
||||
const {
|
||||
x: { destructured },
|
||||
sameName: renamed,
|
||||
} = props;
|
||||
const sameName = foo(destructured);
|
||||
|
||||
return [sameName, renamed];
|
||||
}
|
||||
@@ -516,6 +516,7 @@ const skipFilter = new Set([
|
||||
"bug-jsx-memberexpr-tag-in-lambda",
|
||||
"bug-invalid-code-when-bailout",
|
||||
"component-syntax-ref-gating.flow",
|
||||
"bug-destructuring-same-property-identifier-names",
|
||||
|
||||
// 'react-forget-runtime' not yet supported
|
||||
"flag-enable-emit-hook-guards",
|
||||
|
||||
Reference in New Issue
Block a user