Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

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

未关闭
#1,108 9 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
javascript, react

调研方向

通过克隆链接的 react-18-act-env 示例、安装依赖并运行所述的 npm test 命令来复现该警告。检查调整后的 App 组件及其围绕异步状态更新和 global.IS_REACT_ACT_ENVIRONMENT 的测试;完成的标准是更新仍能完成,且不会记录缺少 act 的警告。

由索引模型根据 Issue 内容生成。

描述

needs more information

This issue was first created in facebook/react, see https://github.com/facebook/react/issues/24854.

The rational behind why we want to disable act warnings: https://github.com/facebook/react/issues/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.

主要语言
JavaScript
星标
19.7k
派生
1.2k
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

testing-library/react-testing-library 的其他 Issue

查看 testing-library/react-testing-library 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。