question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

act cannot detect secondary updates

See original GitHub issue

Do you want to request a feature or report a bug?

bug

What is the current behavior?

If a component performs a second (non user triggered) update, act cannot detect it and warns about the update.

For example, a button is clicked and updates its text. After a second, the button resets and its text reverts to its original state.

https://codesandbox.io/s/6xkyl37x7k?previewwindow=tests

(The reproduction is a bit contrived, but demonstrates the issue.)

What is the expected behavior?

The test runs without warning about being wrapped in act.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

React & React DOM @ 16.8.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

20reactions
threepointonecommented, Feb 7, 2019

We are aware of these problems and are working on a solution, sorry about that.

7reactions
nbrady-techempowercommented, Feb 7, 2019

Since I’m not sure if the issue marked duplicate will be re-opened, I’ll post this here. We have a library that handles async actions and updates state. A very contrived example of something we need to test for is:

  <input value={count} />
  <button onClick={async () => await someFuncThatChangesCount() } />

How do you test this with act? Currently with react-test-renderer we can do:

  expect(val.props.value).toBe(0);
  await button.props.onClick();
  expect(val.props.value).toBe(1);

This will fail:

  expect(val.props.value).toBe(0);
  act(() => {
    button.props.onClick();
  });
  expect(val.props.value).toBe(1);

And this will continue to warn but because act is receiving a promise

  expect(val.props.value).toBe(0);
  act(async () => {
    await button.props.onClick();
  });
  expect(val.props.value).toBe(1);
Read more comments on GitHub >

github_iconTop Results From Across the Web

FFXIV ACT FAQ - gists · GitHub
FFXIV ACT FAQ. TOC. Troubleshooting stuff. My ACT isn't showing any numbers. What can I do? My overlay isn't updating / not showing;...
Read more >
FFXIV — ACT Forums
Warnings not working for patch 6.2 content (FFXIV) ... ACT in secondary PC ... Failed: Cannot detect one or more FFXIV memory signatures....
Read more >
ACT FFXIV Plugin released for v2.4 - Reddit
I've released an update to the ACT FFXIV plugin to work with FFXIV patch 2.4. For those not familiar with Advanced Combat Tracker,...
Read more >
The ACT Test Rescheduled Test Centers
Find out if your ACT test center was rescheduled due to bad weather or unforeseen circumstances.
Read more >
ACT Test Accommodations and English Learner Supports
Please see Examinees Who Are Homeschooled or Are Not Currently Enrolled ... If your high school cannot administer the test, contact ACT as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found