metamask-mobile icon indicating copy to clipboard operation
metamask-mobile copied to clipboard

[Bug]: Activity - Perps and Predictions related transactions appear as `...` for several seconds in the Activity list

Open seaona opened this issue 5 months ago • 3 comments

Describe the bug

Perps and Predictions related transactions appear as ... for several seconds in the Activity list

Expected behavior

Enhance performance or otherwise loading state?

Screenshots/Recordings

https://github.com/user-attachments/assets/99bb24b4-8b99-4964-8bbe-e3bdcbdbecf5

Steps to reproduce

  1. Perform a Perps or Prediction transaction (ie Fund / Withdraw)
  2. Click Activity
  3. See those transactions appear as ... for some seconds until loaded. See the rest of transactions are loaded immediately

Error messages or log output


Where was this bug found?

Internal release testing

Version

8.0.0

Build number

5617

Build type

No response

Device

Pixel 6

Operating system

Android

Additional context

No response

Severity

No response

seaona avatar Jun 22 '26 08:06 seaona

Triage Agent -- Classification

Severity: Sev3 (confidence: 0.88) ✅

This is a cosmetic/UX issue where transactions display as '...' for several seconds before loading. The transactions do eventually load correctly - there's no data loss, crash, or blocked flow. It's a loading state performance issue specific to Perps and Predictions transaction types. Other transactions work fine, and the affected transactions do render after the delay.

Size: size-M (confidence: 0.75) ⚠️ Advisory

The root cause involves the async decodeTransaction call in TransactionElement's componentDidMount, which likely takes longer for Perps/Predictions transaction types due to additional data resolution. The fix may require optimizing the decode path for these transaction types, adding caching, or pre-computing display data. This could touch multiple files (TransactionElement, decodeTransaction utils, possibly the transaction controller metadata). Not auto-applied -- confidence below threshold.

Team: team-mobile-ux ✅

Matched via area fallback: area-transaction-activity (no CODEOWNERS match)


Root Cause Analysis

Affected component: TransactionElement component and its decodeTransaction utility

The TransactionElement component renders a 'pending' state showing '...' as the title until decodeTransaction resolves in componentDidMount. The renderPendingElement method explicitly renders '...' as a placeholder. For standard transactions, decodeTransaction resolves quickly. However, for Perps and Predictions transaction types (perpsDeposit, perpsDepositAndOrder, perpsWithdraw, predictClaim, predictDeposit, predictWithdraw), the decode process likely takes significantly longer. This could be because: (1) The decodeTransaction utility in utils.js has additional async operations for these newer transaction types that involve fetching extra metadata, contract data, or token information. (2) These transaction types may require resolving data from controllers or APIs that aren't immediately available. (3) The transaction types listed in NEW_TRANSACTION_DETAILS_TYPES may have a different decode path that is slower. The key code path is: componentDidMount → decodeTransaction({...}) → sets state with transactionElement and transactionDetails → render() checks isReady → shows renderPendingElement() (with '...') until decode completes.

Evidence:

  • TransactionElement.renderPendingElement() explicitly renders '...' as ListItem.Title when transactionElement/transactionDetails are not yet resolved
  • TransactionElement.render() uses const isReady = Boolean(transactionElement && transactionDetails) to decide between renderTxElement and renderPendingElement
  • componentDidMount calls await decodeTransaction({...}) which is async and sets state only after resolution
  • NEW_TRANSACTION_DETAILS_TYPES array includes perpsDeposit, perpsDepositAndOrder, perpsWithdraw, predictClaim, predictDeposit, predictWithdraw - confirming these are special transaction types
  • Reporter confirms other transactions load immediately while Perps/Predictions take several seconds

Suggested Fix

Confidence: medium: likely but needs investigation - the '...' rendering path is clearly visible in TransactionElement, but the actual bottleneck in decodeTransaction requires examining utils.js which wasn't provided in the KB context

The fix should optimize the decodeTransaction utility for Perps and Predictions transaction types. Since these transaction types already have their display information embedded in the transaction metadata (they use metamaskPay and other custom fields), the decode function should be able to extract display data synchronously or with minimal async work. Alternatively, the TransactionElement component could be updated to show meaningful information (like the transaction type name) immediately while the full decode completes.

Target files: app/components/UI/TransactionElement/utils.js, app/components/UI/TransactionElement/index.js Target functions: decodeTransaction, TransactionElement.componentDidMount, TransactionElement.renderPendingElement

Approach:

  1. Investigate app/components/UI/TransactionElement/utils.js (or utils.ts) to identify what async operations decodeTransaction performs for Perps/Predictions transaction types that cause the multi-second delay. 2. For transaction types in NEW_TRANSACTION_DETAILS_TYPES, consider providing a fast-path decode that extracts basic display info (title, value) synchronously from the transaction metadata, since these types have structured data in tx.type and tx.metamaskPay. 3. As a quick improvement, update renderPendingElement to show the transaction type name (e.g., 'Perps Deposit') instead of '...' by mapping tx.type to a display string immediately, before the full decode completes. 4. Consider caching decoded transaction results to avoid re-decoding on componentDidUpdate. 5. Profile the specific async calls in decodeTransaction for these types to identify the bottleneck (likely a network call, contract lookup, or token resolution that could be cached or skipped).

Confidence threshold: 0.85. Labels marked ✅ were auto-applied. Labels marked ⚠️ are advisory only (below threshold). To re-triage, remove the ta-bot-triage label and re-apply ta-needs-triage. ⚠️ Some dimensions could not be confidently classified. An engineer should review this issue.

metamask-ci avatar Jun 22 '26 08:06 metamask-ci

Should be fixed with Adapters coming on next RC. Will monitor + test

DostoevskysPiano avatar Jun 23 '26 16:06 DostoevskysPiano

Fixed in 8.5

AndyMBridges avatar Jul 30 '26 08:07 AndyMBridges