Skip to content

Commit fc8a898

Browse files
authored
[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
1 parent 97d7949 commit fc8a898

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/error.invalid-rewrite-deps-spread.expect.md

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ function Component(props) {
1212

1313
const deps = [foo, props];
1414

15-
useEffect(() => {
16-
fire(foo(props));
17-
}, ...deps);
15+
useEffect(
16+
() => {
17+
fire(foo(props));
18+
},
19+
...deps
20+
);
1821

1922
return null;
2023
}
@@ -25,13 +28,13 @@ function Component(props) {
2528
## Error
2629

2730
```
28-
11 | useEffect(() => {
29-
12 | fire(foo(props));
30-
> 13 | }, ...deps);
31-
| ^^^^ Invariant: Cannot compile `fire`. You must use an array literal for an effect dependency array when that effect uses `fire()` (13:13)
32-
14 |
33-
15 | return null;
34-
16 | }
31+
13 | fire(foo(props));
32+
14 | },
33+
> 15 | ...deps
34+
| ^^^^ Invariant: Cannot compile `fire`. You must use an array literal for an effect dependency array when that effect uses `fire()` (15:15)
35+
16 | );
36+
17 |
37+
18 | return null;
3538
```
3639
3740

0 commit comments

Comments
 (0)