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

[Compiler Bug]: don't uses dependecies of useMemo #29169

Closed
1 of 4 tasks
Altro31 opened this issue May 19, 2024 · 1 comment
Closed
1 of 4 tasks

[Compiler Bug]: don't uses dependecies of useMemo #29169

Altro31 opened this issue May 19, 2024 · 1 comment

Comments

@Altro31
Copy link

Altro31 commented May 19, 2024

What kind of issue is this?

  • React Compiler core (the JS output is incorrect, or your app works incorrectly after optimization)
  • babel-plugin-react-compiler (build issue installing or using the Babel plugin)
  • eslint-plugin-react-compiler (build issue installing or using the eslint plugin)
  • react-compiler-healthcheck (build issue installing or using the healthcheck script)

Link to repro

https://playground.react.dev/#N4Igzg9grgTgxgUxALhASwLYAcIwC4AEwUYCAsghhAL4EBmMEGBA5DAgIZx4sA6AdgIQAPHPnpR+3NBH4EyATwCCWLAApgBdvwAmCGAWoBKIgIEECcWWEL8OGBGAIBeAiXKUIatSecA+AgADJQAbPEYCABJgMg48AAsAOhgOXSYfakCAGgBtbT0YAF0jMzktBDxYOQAeAGEmLCUCOwcwZ2AWx2oAej8BalKhUVxCOklpWQJ67CUNZvsEQxNgUosrfhsJEJDOlyDoztoAJQgdGABbgHMoBAAvQNXyypganTQANz8ACQRtiAIAOq4EI6IhjbaHardN6fADc-RA1CAA

Repro steps

  1. Look at useMemo.
  2. Dependecies are not used in compilation

How often does this bug happen?

Every time

What version of React are you using?

playground

@Altro31 Altro31 added Component: Optimizing Compiler Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug Type: Bug labels May 19, 2024
@josephsavona
Copy link
Contributor

josephsavona commented May 19, 2024

Thanks for posting. This is expected behavior: the code in this example does not need to be memoized - it’s a template string which can be cheaply compared for equality later - so the compiler removes the unnecessary useMemo.

@josephsavona josephsavona closed this as not planned Won't fix, can't repro, duplicate, stale May 19, 2024
@josephsavona josephsavona removed Type: Bug Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug labels May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants