| 1 | function Component(props) { |
| 2 | // a and b are independent but their mutations are interleaved, so |
| 3 | // they get grouped in a reactive scope. this means that a becomes |
| 4 | // reactive since it will effectively re-evaluate based on a reactive |
| 5 | // input |
| 6 | const a = []; |
| 7 | const b = []; |
| 8 | b.push(props.cond); |
| 9 | a.push(null); |
| 10 | |
| 11 | // Downstream consumer of a, which initially seems non-reactive except |
| 12 | // that a becomes reactive, per above |
| 13 | const c = [a]; |
| 14 | |
| 15 | let x; |
| 16 | if (c[0][0]) { |
| 17 | x = 1; |
| 18 | } else { |
| 19 | x = 2; |
| 20 | } |
| 21 | // The values assigned to `x` are non-reactive, but the value of `x` |
| 22 | // depends on the "control" value `c[0]` which becomes reactive via |
| 23 | // being interleaved with `b`. |
| 24 | // Therefore x should be treated as reactive too. |
| 25 | return [x]; |
| 26 | } |
| 27 | |
| 28 | export const FIXTURE_ENTRYPOINT = { |
| 29 | fn: Component, |
| 30 | params: [{cond: true}], |
| 31 | }; |