[Compiler Bug]: Optimization Fails with Nested Method Shorthand Syntax in Components #31180
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
What kind of issue is this?
Link to repro
https://github.com/hlege/react-compiler-bug
Repro steps
If a nested method shorthand syntax is used in a component that returns an arrow function, it will prevent React's compiler optimizations. However, if the arrow function syntax is used instead, the optimizations work as expected.
The
returnsNonNode(...)
is not skipping the nested function and detects the return type of it, causing the compiler to mistakenly interpret the Functional Component as non-Component functions.Link for code
Tested with:
babel-plugin-react-compiler
version: 0.0.0-experimental-e504e66-20241010Note:
In playground it is work.
How often does this bug happen?
Every time
What version of React are you using?
19.0.0-rc-70fb1363-20241010
The text was updated successfully, but these errors were encountered: