Commit cb287f7
authored
fix: end trace when asset is not available (MetaMask#27131)
<!--
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**
Before this PR, AssetOverviewContent started a manual Sentry trace for
MarketInsightsEntryCardLoad, and the happy-path end happened only when
the MarketInsightsEntryCard component actually mounted. If the asset had
no Market Insights report, that card never rendered, so its endTrace()
never ran. That left the span “open” in the trace map until the generic
cleanup timeout removed it. This is shown in the 5 min traces in the
screenshot.
This PR adds the missing failure/empty-state endTrace() path, ensuring
the trace is closed both when the card renders and when no asset/report
is available, instead of being left dangling until timeout. We can see
that even when the API returns a 404 and the report is not available,
the trace is ended.
<img width="2688" height="734" alt="SCR-20260310-khdy"
src="https://github.com/user-attachments/assets/435b2224-105c-4c08-9c1e-b7ba5a71b02e"
/>
## **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: null
## **Related issues**
Fixes: https://consensyssoftware.atlassian.net/browse/TSA-241
## **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
- [ ] I've included tests if applicable
- [ ] 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**
- [x] I've manually tested the PR (e.g. pull and build branch, run the
app, test code being changed).
- [x] 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]
> **Low Risk**
> Low risk instrumentation-only change that closes a previously orphaned
Sentry span when Market Insights data is missing; main risk is
inadvertently ending a span too early/for the wrong asset id.
>
> **Overview**
> Fixes an orphaned Sentry trace in `AssetOverviewContent` for
`TraceName.MarketInsightsEntryCardLoad` when Market Insights is enabled
but no report exists (e.g., 404), by explicitly calling `endTrace` once
loading completes.
>
> Also makes the `onMarketInsightsDisplayResolved` callback
optional-safe (`?.`) and ensures the effect depends on
`marketInsightsCaip19Id` so trace cleanup aligns with the current asset.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
eb747c2. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 2a5aeb3 commit cb287f7
1 file changed
Lines changed: 16 additions & 6 deletions
Lines changed: 16 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
77 | 82 | | |
78 | 83 | | |
79 | 84 | | |
| |||
312 | 317 | | |
313 | 318 | | |
314 | 319 | | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | 320 | | |
319 | | - | |
| 321 | + | |
320 | 322 | | |
321 | 323 | | |
322 | 324 | | |
323 | 325 | | |
324 | 326 | | |
325 | | - | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
326 | 335 | | |
327 | 336 | | |
328 | 337 | | |
329 | 338 | | |
330 | 339 | | |
| 340 | + | |
331 | 341 | | |
332 | 342 | | |
333 | 343 | | |
| |||
0 commit comments