Commit 6fe856c
fix(perps): enable live PnL in perps position card cp-7.59.0 (#22487)
<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->
## **Description**
This PR enables live PnL (Profit and Loss) updates in the Perps Market
Tabs by subscribing to real-time price updates from the WebSocket
stream.
## **Changelog**
CHANGELOG entry: Fixed live PnL updates in Perps market tabs to reflect
real-time price changes
## **Related issues**
Fixes: https://consensyssoftware.atlassian.net/browse/TAT-1946
## **Manual testing steps**
```gherkin
Feature: Live PnL updates in Perps Market Tabs
Scenario: user views position with live PnL updates
Given user has an open perpetual position
And user is on the Perps Market Tabs screen
When market price changes
Then the unrealized PnL and ROE values update in real-time
And the position card reflects current market conditions
```
## **Screenshots/Recordings**
<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->
### **Before**
No visible changes
### **After**
No visible changes
## **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]
> Enable live PnL updates by passing `useLivePnl: true` to
`usePerpsLivePositions` in `PerpsMarketTabs.tsx`.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
32657d9. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Co-authored-by: Nicholas Smith <nick.smith@consensys.net>1 parent ce4c851 commit 6fe856c
File tree
1 file changed
+4
-1
lines changed- app/components/UI/Perps/components/PerpsMarketTabs
1 file changed
+4
-1
lines changedLines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
221 | | - | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
222 | 225 | | |
223 | 226 | | |
224 | 227 | | |
| |||
0 commit comments