Skip to content

Commit

Permalink
[compiler] Fix broken fire snapshot (#31920)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
poteto authored Dec 26, 2024
1 parent 97d7949 commit fc8a898
Showing 1 changed file with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ function Component(props) {

const deps = [foo, props];

useEffect(() => {
fire(foo(props));
}, ...deps);
useEffect(
() => {
fire(foo(props));
},
...deps
);

return null;
}
Expand All @@ -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;
```

0 comments on commit fc8a898

Please sign in to comment.