chore(runway): cherry-pick fix(perps): improve connection toast (swipe dismiss, delay, styling) cp-7.64.0#25659
Conversation
…e dismiss, delay, styling) cp-7.64.0 (#25569) ## **Description** This PR improves the Perps WebSocket connection toast (the banner that shows "Your connection is offline", "Connecting...", or "Connected" when the WebSocket state changes). ## **Changelog** CHANGELOG entry: Added swipe-to-dismiss and 1 second delay for the Perps connection banner; improved toast styling with default/muted backgrounds and highest z-index. ## **Related issues** Fixes: #25570 Jira issue: https://consensyssoftware.atlassian.net/browse/TAT-2453 ## **Manual testing steps** ```gherkin Feature: Perps connection toast Scenario: user sees and dismisses offline banner Given user is on a screen where Perps WebSocket is connected When connection drops and 1 second passes Then the "Your connection is offline" banner appears at the top And user can swipe the banner left or right to dismiss it And after dismissing, the banner does not show again until connection is restored and drops again Scenario: banner does not flicker on quick reconnect Given user is on a screen where Perps WebSocket is connected When connection drops and reconnects within 1 second Then the offline banner does not appear ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** See here https://consensyssoftware.atlassian.net/browse/TAT-2453 ### **After** <!-- [screenshots/recordings] --> <img width="1206" height="2622" alt="Simulator Screenshot - iPhone 17 Pro - 2026-02-03 at 11 39 17" src="https://github.com/user-attachments/assets/8656ba68-5dd3-4584-bae0-765aa60e1f51" /> ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I've included tests if applicable - [x] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Changes toast timing and suppression logic around WebSocket disconnect/reconnect events, which could inadvertently hide or delay offline/connecting signals. Scope is limited to Perps connection banner UI/state with updated test coverage. > > **Overview** > Improves the Perps WebSocket connection toast UX by adding **horizontal swipe-to-dismiss** and tracking a `userDismissed` state so repeat *Disconnected* banners are suppressed until the connection restores. > > Adds a **1s delay** before showing *Disconnected/Connecting* banners (and cancels pending banners on quick reconnect) to reduce flicker, while still showing the *Connected* success toast immediately. > > Updates toast styling to use a `toastWrapper` with default background + shadow and a muted inner surface, and adjusts tests to cover the new dismissal/timing behavior (including `act()` wrapping for timer-driven animations). > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit c63f170. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
|
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. |
🔍 Smart E2E Test Selection⏭️ Smart E2E selection skipped - base branch is not main (base: release/7.64.0) All E2E tests pre-selected. |
| // Connecting is always shown so user sees progress after having dismissed "offline". | ||
| if (userDismissed && !isConnecting) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
Dismissal resets too early on reconnect
Medium Severity
show() clears userDismissed on WebSocketConnectionState.Connecting, which can allow a previously dismissed offline banner to reappear if the connection flaps Disconnected → Connecting → Disconnected without ever reaching Connected. This contradicts the intended “stay dismissed until restored” behavior.
| } | ||
| // If connection restored during animation, do nothing: leave Connected toast visible | ||
| } | ||
| }); |
There was a problem hiding this comment.
Swipe dismiss can hide toast permanently
Medium Severity
If the user swipes the toast off-screen and the connection becomes Connected before the swipe animation finishes, the completion handler skips calling hide(), but swipeAnim remains translated off-screen. Since swipeAnim resets only when isVisible flips to true, the “Connected” toast can stay invisible/off-screen.
Additional Locations (1)
|
|
No release label on PR. Adding release label release-7.64.0 on PR, as PR was cherry-picked in branch 7.64.0. |




Description
This PR improves the Perps WebSocket connection toast (the banner that
shows "Your connection is offline", "Connecting...", or "Connected" when
the WebSocket state changes).
Changelog
CHANGELOG entry: Added swipe-to-dismiss and 1 second delay for the Perps
connection banner; improved toast styling with default/muted backgrounds
and highest z-index.
Related issues
Fixes: #25570
Jira issue: https://consensyssoftware.atlassian.net/browse/TAT-2453
Manual testing steps
Screenshots/Recordings
Before
See here https://consensyssoftware.atlassian.net/browse/TAT-2453
After
Pre-merge author checklist
Docs and MetaMask Mobile
Coding
Standards.
if applicable
guidelines).
Not required for external contributors.
Pre-merge reviewer checklist
app, test code being changed).
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
Note
Medium Risk
Medium risk because it changes toast display timing/state transitions (new 1s delay and user-dismiss suppression) and adds gesture-driven dismissal, which could affect when users see connection status banners.
Overview
Improves Perps WebSocket connection toast UX and behavior. The toast can now be swipe-dismissed left/right; dismissing sets a
userDismissedflag so repeatedDisconnectedbanners are suppressed until reconnection, whileConnecting/Connectedcan still show and clear the suppression.Reduces banner flicker and refreshes styling.
useWebSocketHealthToastnow delaysDisconnected/Connectingtoasts by 1s (and cancels the timer on reconnect/unmount), whileConnectedstill shows immediately; the toast UI adds a wrapper/inner muted background and updates tests to reflect the new delay and animation/timer behavior.Written by Cursor Bugbot for commit d73b504. This will update automatically on new commits. Configure here.
Co-authored-by: Cursor cursoragent@cursor.com 9642300