Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

post-upgrade, unexpected act warning with findBy queries (includes repro) #1125

Closed
trv-wcaneira opened this issue Sep 16, 2022 · 1 comment · Fixed by #1137
Closed

post-upgrade, unexpected act warning with findBy queries (includes repro) #1125

trv-wcaneira opened this issue Sep 16, 2022 · 1 comment · Fixed by #1137
Labels
bug Something isn't working

Comments

@trv-wcaneira
Copy link

Relevant code or config:

  render(<App />);
  
  //generates an unexpected act warning after upgrading
  await screen.findByText('Loading...')

  const text = await screen.findByText('testing123');
  expect(text).toBeInTheDocument();

What you did:

Upgraded existing application to react 18+ and RTL 13+.

What happened:

A number of tests starting producing act warnings after the upgrade.

In this case, the component being rendered has initial "loading" state before a fetch is completed and the state is changed. Our existing tests awaited the "loading" text. This now produces an act warning.

Reproduction:

I was able to reproduce the issue with a simple CRA repo, here: https://github.com/trv-wcaneira/act-warning-mcve

Problem description:

The act warning is certainly a distraction over hundreds of tests, but concerning because I know it is there for a reason, and I'd like to understand what is wrong.

Suggested solution:

I can replace the await findBy* queries in our tests for this use case, but I'd like to better understand why this is happening (please). I am especially curious because after upgrading, I have noticed a number of behavior changes in existing tests (that I'll file separate issues for).

@eps1lon
Copy link
Member

eps1lon commented Feb 16, 2023

Fixed in #1137
Released in @[email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants