@samitouri / QOS-React / commits / 89f2f7fcef

Make DropManualMemoization error message more accurate

This was probably a leftover from a previous time, but since this error message throws when the dependency list is not an array literal, and not just when its a rest spread, this PR updates the message to match. ghstack-source-id: 28f2338212e56a67d3d477cea5abb6e9f3826488 Pull Request resolved: https://github.com/facebook/react-forget/pull/2902

Lauren Tan committed Apr 25, 2024 at 10:19 UTC 89f2f7fcef11aeaa1abf947a274275fc8a91f472
2 files changed +2 -2
compiler/packages/babel-plugin-react-forget/src/Inference/DropManualMemoization.ts
+1 -1
@@ -301,7 +301,7 @@ function extractManualMemoizationArgs(
301 );
302 if (maybeDepsList == null) {
303 CompilerError.throwInvalidReact({
304 - reason: `Expected the dependency list to be an array literal without rest spreads`,
304 + reason: `Expected the dependency list for ${kind} to be an array literal`,
305 suggestions: null,
306 loc: depsListPlace.loc,
307 });
compiler/packages/babel-plugin-react-forget/src/__tests__/fixtures/compiler/error.useMemo-non-literal-depslist.expect.md
+1 -1
@@ -31,7 +31,7 @@ export const FIXTURE_ENTRYPOINT = {
31 8 | return text.toUpperCase();
32 9 | },
33 > 10 | hasDeps ? null : [text] // should be DCE'd
34 - | ^^^^^^^^^^^^^^^^^^^^^^^ InvalidReact: Expected the dependency list to be an array literal without rest spreads (10:10)
34 + | ^^^^^^^^^^^^^^^^^^^^^^^ InvalidReact: Expected the dependency list for useMemo to be an array literal (10:10)
35 11 | );
36 12 | return resolvedText;
37 13 | }