Skip to content

[Suggestion]: Document unsupported syntax in React Compiler (e.g. inside try/catch) #8685

Description

@gmoniava

Summary

Document unsupported syntax in React Compiler (e.g. inside try/catch)

Page

https://react.dev/learn/react-compiler

Details

React Compiler silently skips components it can't compile, which is intentional (panicThreshold: 'none'). But the docs don't say which patterns trigger a skip, so developers can't tell when a component isn't being optimized.

A write up reports that these patterns inside try/catch prevent compilation:

  • conditionals (if/else)
  • ternaries, optional chaining and ??
  • throw

The compiler's own error confirms at least one of these: Todo: Support value blocks (conditional, logical, optional chaining, etc) within a try/catch statement.

These are common in async code (fetch, then check response.ok), so developers may be affected without knowing.

Request:

  1. Add a list of currently unsupported syntax patterns

No activity

Activity on this issue will appear here.

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