Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Solve all React compiler issues with the eslint plugin #3645

Open
Janpot opened this issue Jun 6, 2024 · 1 comment
Open

[core] Solve all React compiler issues with the eslint plugin #3645

Janpot opened this issue Jun 6, 2024 · 1 comment
Labels
core Infrastructure work going on behind the scenes good first issue Great for first contributions. Enable to learn the contribution process. scope: code-infra Specific to the core-infra product

Comments

@Janpot
Copy link
Member

Janpot commented Jun 6, 2024

Steps to reproduce

4 warnings left around the same issue when running React 19 compiler eslint plugin

/toolpad/packages/toolpad-studio/src/toolpad/AppState.tsx
  885:25  error  Hooks must be the same function on every render, but this value may change over time to a different function. See https://react.dev/reference/rules/react-calls-components-and-hooks#dont-dynamically-use-hooks  react-compiler/react-compiler

/toolpad/packages/toolpad-studio/src/toolpad/ToolpadShell/Header/UserFeedback/index.tsx
  84:33  error  Hooks must be the same function on every render, but this value may change over time to a different function. See https://react.dev/reference/rules/react-calls-components-and-hooks#dont-dynamically-use-hooks  react-compiler/react-compiler

/toolpad/packages/toolpad-studio/src/toolpad/propertyControls/DataProviderSelector.tsx
  43:10  error  Hooks must be the same function on every render, but this value may change over time to a different function. See https://react.dev/reference/rules/react-calls-components-and-hooks#dont-dynamically-use-hooks  react-compiler/react-compiler

/toolpad/packages/toolpad-studio/src/toolpadDataSources/context.tsx
  23:10  error  Hooks must be the same function on every render, but this value may change over time to a different function. See https://react.dev/reference/rules/react-calls-components-and-hooks#dont-dynamically-use-hooks  react-compiler/react-compiler

To see the warnings, set ENABLE_REACT_COMPILER_PLUGIN to true in .eslintrc.js and run pnpm eslint.

Current behavior

No response

Expected behavior

No response

Context

No response

Your environment

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Search keywords: react 19

@Janpot Janpot added good first issue Great for first contributions. Enable to learn the contribution process. scope: code-infra Specific to the core-infra product labels Jun 6, 2024
@Janpot Janpot changed the title [chore] Make React forget ready [chore] Solve all React compiler issues with the eslint plugin Jun 6, 2024
@oliviertassinari oliviertassinari changed the title [chore] Solve all React compiler issues with the eslint plugin [core] Solve all React compiler issues with the eslint plugin Sep 7, 2024
@oliviertassinari oliviertassinari added the core Infrastructure work going on behind the scenes label Sep 7, 2024
@gil-obradors
Copy link
Contributor

I can see these warning changing to "warn" this line:

'react-compiler/react-compiler': 'error',

After some investigation, I came to the conclusion that this warning needs to be disabled because this code does not violate the rules of hooks.
I see some eslint-disble-next-line comments in the project. So, this issue could be solved adding eslint-disable-next-line react-compiler/react-compiler to all warnings, and toggling to warn the rule inside .eslintrc.js ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes good first issue Great for first contributions. Enable to learn the contribution process. scope: code-infra Specific to the core-infra product
Projects
None yet
Development

No branches or pull requests

3 participants