Skip to content

Commit 1fae307

Browse files
authored
feat: cancel limit order (#41484)
## **Description** Cancel limit order flow was missing from market detail screen. ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: Add cancel order flow from market detail entrypoint ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** https://github.com/user-attachments/assets/38f52452-b357-416a-a015-afeeaadd94fd ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/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-extension/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** > Adds a new perps order-cancellation flow that triggers a background `perpsCancelOrder` request and new toast states; mistakes here could prevent cancellations or show incorrect feedback. Scope is UI-focused with tests, but it touches user trading actions and navigation paths. > > **Overview** > Adds a **Cancel Order** flow in perps market detail: clicking an order card now opens a new `CancelOrderModal` that shows key order details and submits `perpsCancelOrder`, with loading/error handling and success/failure perps toasts. > > Updates perps activity so clicking *order* transactions navigates to the relevant market detail page. > > Introduces new i18n strings (`Cancel order`, order detail labels, `Reduce only`, `No`) and extends perps toast key/presentation mappings; adds/updates Jest baselines and tests for the new modal and navigation behavior. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 9e33444. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent ce83d28 commit 1fae307

12 files changed

Lines changed: 1080 additions & 8 deletions

app/_locales/en/messages.json

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/_locales/en_GB/messages.json

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/jest/console-baseline-unit.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,9 @@
289289
"ui/components/app/name/name-details/name-details.test.tsx": {
290290
"React: Act warnings (component updates not wrapped)": 12
291291
},
292+
"ui/components/app/perps/cancel-order/cancel-order-modal.test.tsx": {
293+
"React: Act warnings (component updates not wrapped)": 13
294+
},
292295
"ui/components/app/perps/close-position/close-position-modal.test.tsx": {
293296
"React: Act warnings (component updates not wrapped)": 2
294297
},
@@ -1490,7 +1493,8 @@
14901493
"React: DOM nesting violations": 3
14911494
},
14921495
"ui/pages/perps/perps-market-detail-page.test.tsx": {
1493-
"React: Act warnings (component updates not wrapped)": 5
1496+
"React: Act warnings (component updates not wrapped)": 5,
1497+
"React: State updates on unmounted components": 1
14941498
},
14951499
"ui/pages/perps/perps-order-entry-page.test.tsx": {
14961500
"React: componentWill* lifecycle deprecations": 1

0 commit comments

Comments
 (0)