Skip to content

Bug: global.IS_REACT_ACT_ENVIRONMENT = false does not disable missing act warnings #1108

Open
@anilanar

Description

@anilanar

This issue was first created in facebook/react, see facebook/react#24854.

The rational behind why we want to disable act warnings: facebook/react#23197


Potentially related to using jest. Didn't confirm.

React version: 18.2.0

Steps To Reproduce

  1. Clone https://github.com/anilanar/react-18-act-env ; which is a create-react-app with an adjustment to App component to trigger an async setState and an adjustment to the test to wait for that async state update.
  2. npm install
  3. npm test -- --watchAll

The current behavior

It logs Warning: An update to App inside a test was not wrapped in act(...).

The expected behavior

It does not log that warning.

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