fix(perps): when opening perps quickly after wallet open, the app display $0 for 24h volume and OI - #34844
Conversation
…play $0 for 24h volume and OI Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
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
click to see 🤖 AI reasoning detailsE2E Test Selection:
Tag selection rationale:
The changes are unit-tested and isolated to the Perps hook layer. No shared infrastructure, navigation, or cross-cutting components are affected. Performance Test Selection: |
🧪 Flaky unit test detectionRun history flaky detectionHistorical failure rate is a hint, not proof — review each suggestion in context. See the flaky-test-detection skill for the full pattern reference and manual audit workflow. Failures / runs sampled per window:
AI-detected flaky patterns
|
|
Flaky-test detection triage:
No code change. CI has no failing checks on this PR. |
|
|
| Platform | Device | Reason | Recording |
|---|---|---|---|
| Android | Google Pixel 8 Pro (v14.0) | no_performance_metrics | 📹 Watch |
🔬 App profiling check · Current run 31849339637 · Baseline (last run on main (scenario also failing)) run 30897750395 @ 67486d2
⚠️ No green baseline onmain— comparing against the latest usable profiling.
Summary:
ℹ️ API calls unavailable:
Network logs API error: Bad Request
Full metric table (+10% variance rules)
Disclaimer — allowed variance: a +10% margin over the baseline is permitted.
- If
Current <= Baseline + 10%, treated as acceptable noise.- If
Current > Baseline + 10%, Current and variance % are highlighted with⚠️ .
| Metric | Baseline | Current | Δ |
|---|---|---|---|
| CPU avg | 10.44% | 7.91% | -2.53 (-24.2%) |
| CPU max | 18.83% | 26.31% | +7.48 (+39.7%) |
| Memory avg | 555.64 MB | 815.48 MB | +259.84 (+46.8%) |
| Memory max | 609.03 MB | 987.25 MB | +378.22 (+62.1%) |
| Slow frames | 5.16% | 14.54% | +9.38 (+181.8%) |
| Frozen frames | 0% | 0% | 0 (0%) |
| ANRs | 0 | 0 | 0 (0%) |
| Issues | 2 | 2 | 0 (0%) |
| Critical issues | 1 | 1 | 0 (0%) |
| App size | 328.67 MB | 329.45 MB | +0.78 (+0.2%) |
✅ Passed Tests (1)
| Test | Platform | Device | Duration | Team | Recording |
|---|---|---|---|---|---|
| Perps add funds | Android | Google Pixel 8 Pro (v14.0) | 9.21s | @mm-perps-engineering-team | 📹 Watch |
Branch: TAT-3765-fix-fix-perps-zero-volume-display · Build: E2E · Commit: a0afa88 · View full run



Description
Opening Perps immediately after wallet unlock could show $0.00 for 24h volume and open interest while price, funding, and the order book were already live.
usePerpsMarketStatssubscribed before the Perps client was initialized and never retried, then formatted missing values as$0.00.This waits for
isInitializedbefore subscribing (same pattern asusePerpsPrices) and showsPERPS_CONSTANTS.FallbackPriceDisplayuntil volume and open interest arrive. Confirmed zeros still format as$0.Changelog
CHANGELOG entry: Fixed 24h volume and open interest showing $0.00 when opening Perps right after unlock
Related issues
Fixes: TAT-3765
Manual testing steps
Screenshots/Recordings
Fast Perps open: 24h volume and open interest load as real figures instead of $0.00.
Pre-merge author checklist
Performance checks (if applicable)
trace()for usage andaddTokenfor an exampleFor performance guidelines and tooling, see the Performance Guide.
Pre-merge reviewer checklist
Validation Recipe
recipe.json
{ "$schema": "https://farmslot.io/schemas/recipe-v1.schema.json", "title": "Perps 24h volume and open interest are not fake zeros after a fast open", "description": "Unlock, open BTC market detail immediately, and prove 24h volume and open interest render real market stats instead of $0.00. Requires an unlocked fixture wallet with Perps enabled. Lite market details is used so both figures are fully on screen; they come from the same usePerpsMarketStats hook as the Pro stats bar.", "workflow": { "entry": "setup-status", "nodes": { "setup-status": { "action": "app.status", "intent": "Confirm the mobile bridge is reachable before opening Perps", "next": "setup-cdp" }, "setup-cdp": { "action": "cdp.target", "required": true, "timeout_ms": 15000, "intent": "Confirm the React Native debug bridge is reachable", "next": "setup-restart" }, "setup-restart": { "action": "app.lifecycle", "command": "restart", "settle_ms": 3000, "runtime_ready_timeout_ms": 60000, "intent": "Restart the app so Perps opens from a fresh wallet-launch state", "next": "setup-unlock" }, "setup-unlock": { "action": "metamask.wallet.ensure_unlocked", "intent": "Unlock the wallet so Perps can be opened immediately after launch", "target_timeout_ms": 45000, "unlock_timeout_ms": 45000, "next": "setup-navigate-market" }, "setup-navigate-market": { "action": "ui.navigate", "page": "perps-market", "market": "BTC", "intent": "Open the BTC Perps market detail screen", "next": "setup-wait-header" }, "setup-wait-header": { "action": "ui.wait_for", "test_id": "perps-market-header", "expected": "present", "timeout_ms": 20000, "intent": "Confirm BTC market details finished opening after the fast launch", "next": "setup-wait-scroll" }, "setup-wait-scroll": { "action": "ui.wait_for", "test_id": "perps-market-details-scroll-view", "expected": "present", "timeout_ms": 15000, "intent": "Confirm the Lite market details scroll surface is ready", "next": "ac1-scroll-stats" }, "ac1-scroll-stats": { "action": "ui.scroll", "test_id": "perps-market-details-scroll-view", "offset": 1050, "settle": true, "timeout_ms": 15000, "intent": "Confirm 24h volume and open interest can be read on the market stats card", "next": "ac1-wait-volume" }, "ac1-wait-volume": { "action": "ui.wait_for", "text": "24h volume", "expected": "present", "timeout_ms": 15000, "intent": "Confirm the 24h volume label is on the BTC market stats card", "next": "ac1-screenshot-volume" }, "ac1-screenshot-volume": { "action": "ui.screenshot", "label": "AC1: 24h volume on market stats card", "intent": "Show that 24h volume is a real market figure rather than $0.00", "next": "ac2-wait-oi-label" }, "ac2-wait-oi-label": { "action": "ui.wait_for", "text": "Open interest", "expected": "present", "timeout_ms": 10000, "intent": "Confirm the open interest label is on the BTC market stats card", "next": "ac2-wait-oi-icon" }, "ac2-wait-oi-icon": { "action": "ui.wait_for", "test_id": "perps-market-details-open-interest-info-icon", "expected": "present", "timeout_ms": 10000, "intent": "Confirm the open interest row is mounted on the stats card", "next": "ac2-screenshot-oi" }, "ac2-screenshot-oi": { "action": "ui.screenshot", "label": "AC2: open interest on market stats card", "intent": "Show that open interest is a real market figure rather than $0.00", "next": "done" }, "done": { "action": "end", "status": "pass" } } } }Recipe Workflow
workflow.mmd
Note
Low Risk
Localized Perps UI hook behavior and display formatting with unit tests; no auth, payments, or shared infrastructure changes.
Overview
Fixes 24h volume and open interest showing fake $0.00 when Perps is opened right after wallet unlock.
usePerpsMarketStatsnow waits onisInitializedfromusePerpsConnectionbefore callingsubscribeToPrices, matchingusePerpsPrices, so an early no-op subscribe is retried once the client is ready. Until volume and open interest arrive, the UI usesPERPS_CONSTANTS.FallbackPriceDisplayinstead of formatting missing values as$0.00; confirmed zero values still render as$0.Tests mock
usePerpsConnectionand cover init gating, post-init subscribe, fallback display, and real zeros.Reviewed by Cursor Bugbot for commit bbf72c4. Bugbot is set up for automated code reviews on this repo. Configure here.