feat: perps toast display for order close and modify#41489
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. |
✨ Files requiring CODEOWNER review ✨👨🔧 @MetaMask/perps (9 files, +830 -52)
|
Builds ready [e170625]
⚡ Performance Benchmarks (Total: 🟢 6 pass · 🟡 12 warn · 🔴 0 fail)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [d7d2974]
⚡ Performance Benchmarks (Total: 🟢 6 pass · 🟡 12 warn · 🔴 0 fail)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [bfeb944]
⚡ Performance Benchmarks (Total: 🟢 6 pass · 🟡 12 warn · 🔴 0 fail)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Builds ready [6f71060]
⚡ Performance Benchmarks (Total: 🟢 6 pass · 🟡 12 warn · 🔴 0 fail)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
a2619e4 to
953695f
Compare
|
Builds ready [953695f]
⚡ Performance Benchmarks (Total: 🟢 7 pass · 🟡 12 warn · 🔴 0 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|



Description
This pull request fixes missing toast feedback for perps actions launched from modal-based position management flows. Users already saw toast feedback when opening long or short positions from the main trading flow, but modal actions like close and reverse position could complete without equivalent feedback, creating an inconsistent and lower-confidence UX.
The change wires close-position and reverse-position modals into the perps toast system, so users now get in-progress, success, and failure feedback for those actions. It also refines close-position copy to match the product model more closely by distinguishing full close from partial close, including parity-aligned partial-close messaging such as “Partially closing position” and “Position partially closed.” Existing TP/SL and margin toast behavior remains intact, and regression coverage was expanded to lock in the new toast states and copy.
Changelog
CHANGELOG entry: null
Related issues
Fixes: https://consensyssoftware.atlassian.net/browse/TAT-2840
Manual testing steps
Feature: Perps modal toast parity
Scenario: Open a Long from Perps home shows existing open-order toasts
Given I am on the Perps home screen
And I have enough balance to open a position
When I open a Long position from the home screen
Then I should see the existing order submission toast behavior
And after the action completes I should see the existing success toast behavior
Screenshots/Recordings
Before
After
modifyClose.mov
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Low risk UX change that adds/adjusts perps toast notifications and refactors PnL ratio calculation; no changes to trading requests beyond parameter construction and messaging. Main risk is incorrect toast copy/triggering for partial vs full close edge cases.
Overview
Adds perps toast parity for modal-based position management by emitting in-progress/success/failure toasts from
ClosePositionModalandReversePositionModal.Close-toasts now distinguish full close vs partial close (new i18n keys/copy and a “position still active” failure subtitle), include an optional PnL subtitle when computable, and the PnL ratio logic is centralized into
getPositionPnlRatio(reused by the order entry page). Test coverage is expanded to assert toast key mapping/presentation and modal toast emission for success/failure paths.Reviewed by Cursor Bugbot for commit 953695f. Bugbot is set up for automated code reviews on this repo. Configure here.