[compiler] Fix broken fire snapshot (#31920)

This was not committed in #31811
---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/facebook/react/pull/31920).
* #31919
* #31918
* #31917
* #31916
* #31915
* __->__ #31920
This commit is contained in:
lauren
2024-12-26 14:58:37 -05:00
committed by GitHub
parent 97d794958f
commit fc8a898dd1
@@ -12,9 +12,12 @@ function Component(props) {
const deps = [foo, props];
useEffect(() => {
fire(foo(props));
}, ...deps);
useEffect(
() => {
fire(foo(props));
},
...deps
);
return null;
}
@@ -25,13 +28,13 @@ function Component(props) {
## Error
```
11 | useEffect(() => {
12 | fire(foo(props));
> 13 | }, ...deps);
| ^^^^ Invariant: Cannot compile `fire`. You must use an array literal for an effect dependency array when that effect uses `fire()` (13:13)
14 |
15 | return null;
16 | }
13 | fire(foo(props));
14 | },
> 15 | ...deps
| ^^^^ Invariant: Cannot compile `fire`. You must use an array literal for an effect dependency array when that effect uses `fire()` (15:15)
16 | );
17 |
18 | return null;
```