fix(perps): privacy mode#27128
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. |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
All changes use the existing Tag selection rationale:
Performance Test Selection: |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
| <PerpsHomeSection | ||
| title={strings('perps.home.positions')} | ||
| subtitle={positionsSubtitle} | ||
| subtitle={privacyMode ? undefined : positionsSubtitle} |
There was a problem hiding this comment.
Subtitle color still leaks PnL direction in privacy mode
Low Severity
When privacy mode is on, subtitle is correctly set to undefined so it won't render, but subtitleColor is still passed with the directional color (TextColor.Success or TextColor.Error). Currently this is safe because PerpsHomeSection guards with {subtitle && (...)}. However, every other component in this PR explicitly forces TextColor.Default when privacy mode is on (e.g., PerpsPositionsView, PerpsPositionCard, PerpsCard), making this the only place that omits the color-neutralization pattern described in the PR's "Color leaking fix."
There was a problem hiding this comment.
It doesn't as you can see on the screenshot
The committed fixture schema is out of date. To update, comment: |
|





Description
Perps screens had no privacy mode support — enabling the wallet privacy toggle had no effect on any financial values displayed in the perpetuals trading UI.
This PR integrates
SensitiveText(withselectPrivacyMode) across all Perps components that render sensitive financial data, following the same pattern already established by the Predict feature.What changed:
PerpsMarketBalanceActions— total balance and available balance value hidden behind dots; transaction in-progress amounts (deposit/withdrawal) also hiddenPerpsCard— position value and PnL/ROE label on the home screen cards hiddenPerpsPositionCard— comprehensive coverage: PnL, ROE, position value, size, margin, entry price, liquidation price, TP/SL prices, and funding payments all hidden; liquidation distance % and icon suppressedPerpsPositionsView— all four account summary values (total balance, available balance, margin used, total unrealized PnL) hiddenPerpsHomeView— positions section PnL subtitle hiddenColor leaking fix: Values with directional colors (green for profit, red for loss) are forced to
TextColor.Defaultwhen privacy mode is on, so the color itself cannot reveal whether a position is profitable or not.Tests: Privacy mode test blocks added to all four affected test files.
PerpsCard.test.tsxalso received a missingreact-reduxmock that was required after theuseSelectorcall was introduced.Changelog
CHANGELOG entry: Fixed privacy mode not hiding financial values on Perps screens
Related issues
Fixes: #23187
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Medium Risk
Touches multiple Perps UI surfaces and display logic to conditionally hide values and neutralize PnL coloring; risk is mainly UI regressions or incorrectly hidden/shown fields, not core trading behavior.
Overview
Adds Perps support for wallet privacy mode by wiring
selectPrivacyModeinto the home, positions list, and position-detail surfaces and replacing sensitive numeric fields withSensitiveTextdots.This also prevents profit/loss direction leakage by forcing neutral text colors and suppressing liquidation distance UI when privacy mode is on, and updates/extends unit tests to cover privacy-on/off rendering (including required Redux selector mocks).
Written by Cursor Bugbot for commit 8523c4f. This will update automatically on new commits. Configure here.