-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat: Create ToastService and add unit tests #25464
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
Conversation
|
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
…25463-extend-toast-functionality
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
The risk is low because:
However, since the ToastContextWrapper wraps the entire app (used in Root/index.tsx) and toasts are used across many features (accounts, permissions, predictions, perps, confirmations), I'm selecting SmokeAccounts and SmokeConfirmationsRedesigned to verify core toast functionality still works. These tags cover account-related toasts (address copying, account switching) and confirmation-related toasts which are common use cases. Performance Test Selection: |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #25464 +/- ##
==========================================
- Coverage 80.28% 75.45% -4.83%
==========================================
Files 4260 4261 +1
Lines 110124 110173 +49
Branches 23477 23475 -2
==========================================
- Hits 88409 83130 -5279
- Misses 15506 21015 +5509
+ Partials 6209 6028 -181 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|



Description
The purpose of these changes is to extend the functionality of triggering the global Toast UI from services. In other words, with these changes, you can now show a toast from non-components by leveraging the
ToastService. Example usage isToastService.showToastorToastService.closeToast.Changelog
CHANGELOG entry:
Related issues
Fixes: #25463
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Introduces a global singleton that stores a React ref and throws/logs when unavailable, which can affect app-wide toast behavior if registration timing or lifecycle is off. Scope is otherwise small and covered by unit tests.
Overview
Enables triggering the global Toast UI from non-React code by adding a new
core/ToastServicesingleton withshowToast/closeToastAPIs that proxy through a stored toastref(and log+throw when the ref is missing).Updates
ToastContextWrapperto register itstoastRefwithToastServiceon mount, and adds unit tests covering ref management, proxy behavior, and error paths.Written by Cursor Bugbot for commit 7c2803c. This will update automatically on new commits. Configure here.