Skip to content

fix: top traders section disappears on fetch error#29501

Merged
zone-live merged 11 commits into
mainfrom
TSA-481-top-traders-section-disappears-homepage
May 5, 2026
Merged

fix: top traders section disappears on fetch error#29501
zone-live merged 11 commits into
mainfrom
TSA-481-top-traders-section-disappears-homepage

Conversation

@zone-live

@zone-live zone-live commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Description

The Top Traders homepage section would silently disappear whenever the leaderboard API call failed. This happened because the section guard condition treated a failed fetch, where isLoading is false and traders is empty. Identically to a genuinely empty result set, causing return null.
We now show the default error state when that happens and while the user Retries the request the skeleton is also activated while the request is in-flight.

Simulator Screenshot - iPhone 17 Pro - 2026-04-29 at 16 17 58

Changelog

CHANGELOG entry: null

Related issues

Fixes:

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

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.

Note

Medium Risk
Moderate UI/telemetry change: alters Top Traders section render gating and adds new SocialService error telemetry (Logger extras + Sentry breadcrumbs) across multiple hooks, which could affect user-visible states and error reporting but not security-sensitive logic.

Overview
Prevents the homepage Top Traders section from disappearing on leaderboard fetch failures by distinguishing empty vs error vs background refetch states, rendering an ErrorState with Retry, and showing skeletons while a retry is in-flight (while keeping cached traders visible on refetch failures).

Adds shared SocialService telemetry helpers (socialServiceTelemetry) and updates Social Leaderboard hooks to emit enriched Logger.error extras and Sentry breadcrumbs (including endpoint, coarse error category, and optional HTTP status/query params), with tests updated/expanded accordingly.

Reviewed by Cursor Bugbot for commit fcbc39b. Bugbot is set up for automated code reviews on this repo. Configure here.

@zone-live zone-live added the team-social-ai Social & AI team label Apr 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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.

Comment thread app/components/Views/Homepage/Sections/TopTraders/TopTradersSection.tsx Outdated
Comment thread app/components/Views/Homepage/Sections/TopTraders/TopTradersSection.tsx Outdated
Comment thread app/components/Views/Homepage/Sections/TopTraders/TopTradersSection.tsx Outdated
@github-actions github-actions Bot added size-L and removed size-M labels Apr 30, 2026
joaosantos15
joaosantos15 previously approved these changes Apr 30, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit aad08f6. Configure here.

Comment thread app/util/social/socialServiceTelemetry.ts
Comment thread app/components/Views/Homepage/Sections/TopTraders/TopTradersSection.tsx Outdated
@github-actions

github-actions Bot commented May 4, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeWalletPlatform
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 88%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes in this PR are focused on the Social Leaderboard / Top Traders feature area:

  1. New telemetry utility (socialServiceTelemetry.ts): A new file providing structured error categorization and Sentry breadcrumb helpers for Social Service API calls. This is purely observability infrastructure with no user-facing behavior changes.

  2. useTopTraders.ts: Added isFetching to the return type and integrated the new telemetry utility for richer error logging. No functional behavior change beyond better error observability.

  3. TopTradersSection.tsx (Homepage): The most user-visible change — added an ErrorState component render when the leaderboard fetch fails (previously nothing was shown on error). Also improved loading state logic using isFetching alongside isLoading. This is a UI improvement for the Top Traders section on the Homepage.

  4. useFollowedTraders.ts, useTraderPosition.ts, useTraderPositions.ts: All received the same telemetry integration pattern — structured error logging with breadcrumbs. No functional behavior changes.

  5. Test files: Unit tests covering the above changes.

Tag Selection Rationale:

  • SmokeWalletPlatform is the appropriate tag because:
    • The TopTradersSection is embedded in the Homepage/Trending tab, which is explicitly covered by SmokeWalletPlatform ("Trending discovery tab: search functionality, browsing content feeds (Predictions, Tokens, Perps, Sites sections)")
    • The Social Leaderboard views (TopTradersView, TraderProfileView, NotificationPreferencesView) are part of the Trending/discovery section
    • The error state rendering change in TopTradersSection is a user-visible change that should be validated

No other tags are needed because:

  • No changes to confirmations, swaps, staking, accounts, networks, or other major flows
  • No changes to core controllers, Engine, or shared infrastructure
  • The changes are isolated to the Social Leaderboard feature area within the Trending/Homepage section

Performance Test Selection:
The changes are focused on error handling improvements and telemetry additions for the Social Leaderboard feature. There are no changes to rendering performance, list rendering algorithms, data loading patterns, or critical user flows that would impact measurable performance metrics. The new telemetry utility adds minimal overhead (Sentry breadcrumbs on error paths only). No performance tests are warranted.

View GitHub Actions results

@sonarqubecloud

sonarqubecloud Bot commented May 4, 2026

Copy link
Copy Markdown

@Bigshmow Bigshmow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice fix, left a non-blocking comment about explicit error messages, otherwise good to go.

@zone-live zone-live added this pull request to the merge queue May 5, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 5, 2026
@zone-live zone-live added this pull request to the merge queue May 5, 2026
Merged via the queue into main with commit 03cf010 May 5, 2026
162 of 168 checks passed
@zone-live zone-live deleted the TSA-481-top-traders-section-disappears-homepage branch May 5, 2026 09:16
@github-actions github-actions Bot locked and limited conversation to collaborators May 5, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.77.0 Issue or pull request that will be included in release 7.77.0 label May 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.77.0 Issue or pull request that will be included in release 7.77.0 size-XL team-social-ai Social & AI team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants