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]: function parameter inside component override outer parameter incorrectly #31014

Open
1 of 4 tasks
pilaoda opened this issue Sep 21, 2024 · 0 comments
Open
1 of 4 tasks
Labels
Component: Optimizing Compiler Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug Type: Bug

Comments

@pilaoda
Copy link

pilaoda commented Sep 21, 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/#N4Igzg9grgTgxgUxALhHCA7MAXABASwwBMEAPAfQAZcBeXGBARynwYAoAdEAOgHpIAtgl6ESpLgEoA3BwyyAZlAxxs+TLgBiMfAmIAZfDjbACxMrgC+E3MFm5c6LHnnbdRAAoBDDAgA2YWlwXHWIwbgFPAAc2NmC3ABpTMWsaAD4bO3tcXl5cMARHIlxPGABzXAh5XAjIioA3BBhtElxsAAsECqhsRqSyKmL5HpgHCAFI-F8ETPsGbFgMXAAeUX7KbgBlMYQvH19UmayuOOJkLlwAaiDXYku+0hlFrKWRMwp1raFdvwOnq0fZgh5jBFksiPg6r8sjYTh5vH4wBZMi9wZDZLIkRgQBYgA

Repro steps

Using webpack with typescript.
import { SomePanel } "./some/index"; may compiled into something like const index_0 = __importDefault(__webpack_require__("./some/index.js"));

React compiler don't recongize it, and compile the index arg in array.map((value, index)=>{}) into index_0, which falsy override the imported module and become a number.

How often does this bug happen?

Every time

What version of React are you using?

19.0.0-rc-4c58fce7-20240904

@pilaoda pilaoda added Component: Optimizing Compiler Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug Type: Bug labels Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Optimizing Compiler Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug Type: Bug
Projects
None yet
Development

No branches or pull requests

1 participant