这是indexloc提供的服务,不要输入任何密码
Skip to content

[Compiler Bug]: Mutating local variable created from destructuring a prop is incorrectly detected as a prop mutation #33781

@laug

Description

@laug

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/#N4Igzg9grgTgxgUxALhAgHgBwjALgAgBMEAzAQygBsCSoA7OXASwjvwEFNMAKASn2AAdOsPz44rMAUJlcZfAF4BosfiaFk+AORkARnEJaANCrFM6xdJoCMAJgDMJtqoi4AFghiYYETJq0elJQQxioAvgDcwiowCLiwbNym+AA8AHzJYikAKhi4AMIQALbYdAh00rJkCsAycmH4APQZzlnNKrxRdGHRdOa4nuSI+LlShSWs5bgACj6YYMrOdWSawGoa+FIw5gDmEWoWGJp0UEW6nvuuHl5zmlu7+JHCPSJlWDg09IwsbKMFxaUptxvL4wJo-uNARVZqD+EJXmIJHQpAIiFVHop8CD5l0YnEEvgkq1UrooLhcKxMvhWPlKEw4ABrGp8RRpRaqDniSQENbqIz4AB0QuWAHUmO5oLgAJKEDFKZZdTmqRqNfAAA1F4rckplarUC3kZQA7vhgnAyJR8AA3MjbPSUBACqliFX4ACyZNkD01ErJMqIEAQCzornwRU9AzRcidxI5roAyhB8O4EFySkwHTB8EbbX06Dt9fh5ORKGBU9gwOKmFbHc6o2Qxb7pYQBeZLJiACy2RVKrnIiAOgXBHbcZatw7oTpNVV2eyEkMELu8KlhMItJWUPQISjJFKNUnk1jr-CdZ69EBhIA

Repro steps

To repro, simply open the playground link, the compiler error will be shown directly.

The compiler error is a false positive, because the variable being mutated is a local variable, and mutating it does not result in the prop's value being mutated.

How often does this bug happen?

Every time

What version of React are you using?

19.1.0

What version of React Compiler are you using?

0.0.0-experimental-acd39a6-20250710

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