-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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: prevent race condition for swap state #6624
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #6624 +/- ##
==========================================
- Coverage 60.18% 60.05% -0.13%
==========================================
Files 719 719
Lines 21143 21143
Branches 6974 6974
==========================================
- Hits 12724 12697 -27
- Misses 8342 8369 +27
Partials 77 77
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
1 flaky tests on run #11211 ↗︎
Details:
cypress/e2e/swap/swap.test.ts • 1 flaky test • e2e
This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. |
nice fix! |
Description
This bug happens when the
ConfirmSwapModal
is dismissed before theswapCallback
promise resolves.When the bug happens, the state is set like this:
ConfirmSwapModal
->showConfirm
is true (set on L783)handleSwap
is called and triggers theswapCallback
(L426).showConfirm
is still true at this pointhandleConfirmDismiss
is called andshowConfirm
is set tofalse
swapCallback
resolves and setsshowConfirm
to an outdated value (L428) which re-opens the modalTest plan
Reproducing the error
swap/errors.test.ts
test suite - it's flaky because this race condition causes the modal to stay visible when it shouldn'tQA (ie manual testing)
Automated testing