Skip to content

[Compiler Bug]: Does not check for ref access in setState initial value function #31418

Open
@aeharding

Description

@aeharding

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/#N4Igzg9grgTgxgUxALhAMygOzgFwJYSYAEAKgmDgBQCURwAOsUXIRUTgIYBGASgmkQC8RKGAR80NRkRFiAypxwJKNIQD523CQDo4sGAkw5qAbkYBfEOaA

Repro steps

The playground compiles, but it should fail (Rules of React)

How often does this bug happen?

Every time

What version of React are you using?

latest playground

What version of React Compiler are you using?

latest playground

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions