@samitouri / QOS-React-2 / commits / fc8a898dd1

[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

lauren committed Dec 26, 2024 at 14:58 UTC fc8a898dd126198305fce458edd084c5d9c4b67a
1 file changed +13 -10
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/error.invalid-rewrite-deps-spread.expect.md
+13 -10
@@ -12,9 +12,12 @@ function Component(props) {
12
13 const deps = [foo, props];
14
15 - useEffect(() => {
16 - fire(foo(props));
17 - }, ...deps);
15 + useEffect(
16 + () => {
17 + fire(foo(props));
18 + },
19 + ...deps
20 + );
21
22 return null;
23 }
@@ -25,13 +28,13 @@ function Component(props) {
28 ## Error
29
30 ```
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;
38 ```
39
40
\ No newline at end of file