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

Warning about overlapping act() calls when using Promise.all / Axios.all #615

Closed
vallq opened this issue Mar 18, 2020 · 3 comments
Closed

Comments

@vallq
Copy link

vallq commented Mar 18, 2020

  • @testing-library/react version:
  • react version: 16.13.0
  • node version: v13.5.0
  • npm (or yarn) version: 6.14.1

Relevant code or config:

await Axios.all([
          axios.post("/publish", articleDetails),
          axios.post("/articles", articleDetails)
        ]);

What you did:

Trying to make multiple axios calls (appended with baseURL) using Axios.all causes the following warning message:

What happened:

console.error node_modules/react-dom/cjs/react-dom-test-utils.development.js:87
Warning: You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one.

Problem description:

Working on an external product for a client; would like to get rid of console error warnings

@eps1lon
Copy link
Member

eps1lon commented Mar 18, 2020

We need more information to debug this issue (component code, test code, @testing-library/react version etc).

We don't have the bandwidth to deep-dive without complete information.

@AndreasPresthammer
Copy link

AndreasPresthammer commented Apr 23, 2020

Seeing a similar issue using Promise.all.

See repro: https://codesandbox.io/s/focused-lehmann-438q7?file=/src/__tests__/index.js

Seem's to me like the findBy* api isn't intended to be run concurrently? If that is the case, is this documented anywhere?

@kentcdodds
Copy link
Member

Yeah, they're not intended to be run concurrently. If you need them to for some reason, then you can do this: https://codesandbox.io/s/happy-framework-hjzlx?file=/src/__tests__/index.js:458-608

await waitFor(() => [
  screen.getByTestId('my-id-1'),
  screen.getByTestId('my-id-2'),
])

I'm not sure whether there's anything we need to or can do about this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants