From fc8a898dd126198305fce458edd084c5d9c4b67a Mon Sep 17 00:00:00 2001 From: lauren Date: Thu, 26 Dec 2024 14:58:37 -0500 Subject: [PATCH] [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 --- ...rror.invalid-rewrite-deps-spread.expect.md | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/error.invalid-rewrite-deps-spread.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/error.invalid-rewrite-deps-spread.expect.md index 7c1b55f61d909..91c5523564cdd 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/error.invalid-rewrite-deps-spread.expect.md +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/transform-fire/error.invalid-rewrite-deps-spread.expect.md @@ -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; ``` \ No newline at end of file