mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
[rhir] Visit DoWhile's test as a conditional dependency
Missed this in the prior PR!
This commit is contained in:
@@ -576,7 +576,9 @@ function visit(context: Context, block: ReactiveBlock): void {
|
||||
}
|
||||
case "do-while": {
|
||||
visit(context, terminal.loop);
|
||||
visitReactiveValue(context, terminal.id, terminal.test);
|
||||
context.enterConditional(() => {
|
||||
visitReactiveValue(context, terminal.id, terminal.test);
|
||||
});
|
||||
break;
|
||||
}
|
||||
case "while": {
|
||||
|
||||
@@ -20,7 +20,7 @@ function Component(props) {
|
||||
```javascript
|
||||
function Component(props) {
|
||||
const $ = React.unstable_useMemoCache(2);
|
||||
const c_0 = $[0] !== props.cond;
|
||||
const c_0 = $[0] !== props;
|
||||
let x;
|
||||
if (c_0) {
|
||||
x = [0, 1, 2, 3];
|
||||
@@ -31,7 +31,7 @@ function Component(props) {
|
||||
|
||||
mutate(x);
|
||||
} while (props.cond);
|
||||
$[0] = props.cond;
|
||||
$[0] = props;
|
||||
$[1] = x;
|
||||
} else {
|
||||
x = $[1];
|
||||
|
||||
Reference in New Issue
Block a user