fix(MUSD-402): resolve persisting mUSD success toast after rapid transaction confirmation#28040
Merged
Merged
Conversation
Contributor
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
Contributor
|
Hey @Kureev I think we also need to replicate these changes in https://github.com/MetaMask/metamask-design-system/blob/main/packages/design-system-react-native/src/components/Toast/Toast.tsx right? Because we are in the middle of the migration to DSRN package 👀 |
Contributor
Author
Heya 👋 ! |
…nfirmation When a transaction confirms very quickly after approval (e.g., on Linea), both showToast calls arrive before React processes the first state update, causing the in-progress toast's hasNoTimeout animation to persist even after the success toast content renders. Track pending setTimeout with a ref so only the latest showToast call wins.
Matt561
approved these changes
Mar 30, 2026
brianacnguyen
approved these changes
Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Toast.showToastwhere rapid successive calls (e.g., transaction approved + confirmed in the same tick on Linea) cause the success toast to persist indefinitelysetTimeoutwith a ref so only the latestshowToastcall wins, ensuring the success toast renders with its proper auto-dismiss animationshowToastscenarioScreen.Recording.2026-03-27.at.14.46.49.mov
Test plan
yarn jest app/component-library/components/Toast/Toast.test.tsx)Note
Medium Risk
Touches toast display timing/animation logic; small but could regress toast sequencing or dismissal behavior if timer clearing interacts with existing transitions.
Overview
Fixes a race in
Toast.showToastwhere back-to-back calls could leave multiple queuedsetTimeoutupdates, causing the wrong toast state/timeout behavior (e.g., a success toast persisting).Toastnow tracks and clears any pendingsetTimeoutvia a ref so only the latestshowToastcall applies. Adds a unit test asserting rapid successive calls leave a single pending timer and only the latest toast renders.Written by Cursor Bugbot for commit 111df6d. This will update automatically on new commits. Configure here.