[Compiler Bug]: React compiler discards computed property keys when used in method shorthand
Open
Nobody has claimed this yet.
Component: React Compiler
Type: Bug
- Dominant language
- JavaScript
- Stars
- 251k
- Forks
- 51.4k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 53
Description
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-hooks (build issue installing or using the eslint plugin)
- react-compiler-healthcheck (build issue installing or using the healthcheck script)
Link to repro
Repro steps
See the playground link for the full example.
pass an object with a computed key to a react component
eg:
<Bar obj={{ [computedPropKey]() { } }} />
observe the compiler generates incorrect code
<Bar obj={{ computedPropKey() {} }} />
How often does this bug happen?
Every time
What version of React are you using?
latest on the compiler playground
What version of React Compiler are you using?
latest on the compiler playground
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked React Compiler playground repro and compare the input object with the generated output. No repository file or test is named in the issue; done means a computed property key used with method shorthand remains computed in the compiler output, with coverage for the reported example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100