[rhir] Visit DoWhile's test as a conditional dependency

Missed this in the prior PR!
This commit is contained in:
Lauren Tan
2023-03-03 00:31:37 -05:00
parent de6444b4f5
commit 0ad0f8cf43
2 changed files with 5 additions and 3 deletions
@@ -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];