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

fix: wait after each method before leaving asyncWrapper #952

Merged
merged 2 commits into from May 12, 2022
Merged

Conversation

ph-fritsche
Copy link
Member

What:

Wait for asynchronous state updates before leaving the asyncWrapper

Why:
Closes #938

How:

Add a wait call after the respective method when wrapping in asyncWrapper.
That should prevent act warnings on the await right before an API call as it returns on a fresh macrotask.

Checklist:

  • Tests
  • Ready to be merged

** Additional information **
Codesandbox example:
https://codesandbox.io/s/billowing-hooks-h5oj5w?file=/src/App.test.js

@codesandbox-ci
Copy link

codesandbox-ci bot commented May 11, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 6ee1ed0:

Sandbox Source
userEvent-dom Configuration
userEvent-react Configuration
peaceful-mopsa-xq06r8 PR

@codecov
Copy link

codecov bot commented May 11, 2022

Codecov Report

Merging #952 (6ee1ed0) into main (ab78f3f) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main      #952   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           85        85           
  Lines         1785      1788    +3     
  Branches       649       649           
=========================================
+ Hits          1785      1788    +3     
Impacted Files Coverage Δ
src/setup/setup.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ab78f3f...6ee1ed0. Read the comment docs.

@ph-fritsche ph-fritsche merged commit 6f55fee into main May 12, 2022
@ph-fritsche ph-fritsche deleted the delay branch May 12, 2022 10:33
@github-actions
Copy link

🎉 This PR is included in version 14.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

.clear in v14 produces an act warning when used with React hook form.
1 participant