fix: prevent surplus modal from re-queuing auto-shown orders#7213
Conversation
|
@minato32 is attempting to deploy a commit to the cow-dev Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughA cleanup Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
e1469d6 to
d67da26
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
fixes #7189 |
Summary
Fixes #7189
Fix progress modal not opening when clicking "Show progress" from the account modal after navigating away from the swap page.
When a swap is submitted,
tradeConfirmStateAtomis set to{ isOpen: true, transactionHash: orderId }. If the user navigates away from the swap page (e.g., to/account/tokens),TradeWidgetModalsunmounts but the atom state persists. This causesSurplusModalSetupto think the confirmation modal is already displaying the order, so it refuses to open the progress modal and immediately removes the order from the surplus queue.The fix resets the trade confirm state when
TradeWidgetModalsunmounts, soSurplusModalSetupcorrectly seesisConfirmationModalOpen: falseafter navigation.To Test
/account/tokens)Background
SurplusModalSetup(rendered inTopLevelModals, always mounted) checkstradeConfirmStateAtom.isOpento avoid showing a duplicate modal when the trade confirmation is already visible. However,tradeConfirmStateAtomis global Jotai state that was never cleaned up on navigation — only on account/chain changes. This meant the staleisOpen: trueblocked the surplus modal from ever opening after the user left the swap page.Summary by CodeRabbit