Skip to content

[Compiler Bug]: wrong check with all props object ($[0] !== props) when accessing the function from the props object and calls it, e.g. props.reportBug() #31763

@dimaMachina

Description

@dimaMachina

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

Repro steps

I found an issue with react-compiler, which makes fails this test https://github.com/graphql/graphiql/blob/8092f100ae62710bece1666589eda0455dc04009/packages/graphiql/src/GraphiQL.spec.tsx#L76-L84

As you can see function introspect contains reference to props.schema, props.fetcher and props.onSchemaChange but the react-compiler simplified it to $[13] !== props which is wrong!

For now, I fixed this with this commit: graphql/graphiql@3ecae05 by avoid having props.something... inside body of introspect function

I hope this will be prioritized and fixed soon, friendly ping gsathya

How often does this bug happen?

Every time

What version of React are you using?

from playground

What version of React Compiler are you using?

from playground

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