Skip to content

Bug: React-compiler does not handle potentially null objects gracefully when caching function that may not be run due to short-circuit evaluation #31269

@bjnsn

Description

@bjnsn

React version: React 18;
react-compiler-runtime: 0.0.0-experimental-605e95c-20241015
babel-plugin-react-compiler: 0.0.0-experimental-605e95c-20241015

Steps To Reproduce

  1. Use the current react-compiler-runtime / babel-plugin-react-compiler with the small repro shown in this link

React compiler playground link

The current behavior

Errors when trying to access null object

The expected behavior

Should not access null object which would not be accessed without compiler due to short-circuit evaluation.

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