Skip to content

fix(perps): remove loading delay from tutorial screen#20918

Merged
abretonc7s merged 15 commits into
mainfrom
feat/perps/optimize-connection
Oct 10, 2025
Merged

fix(perps): remove loading delay from tutorial screen#20918
abretonc7s merged 15 commits into
mainfrom
feat/perps/optimize-connection

Conversation

@abretonc7s

@abretonc7s abretonc7s commented Oct 8, 2025

Copy link
Copy Markdown
Contributor

Description

Perps tutorial was taking >5 seconds to load due to being wrapped in PerpsConnectionProvider, which blocks rendering until WebSocket connection completes.

Solution: Moved Tutorial to app-level navigation (outside provider) while keeping all connected screens inside. Connection now initializes in background during tutorial, eliminating the loading delay.

Changelog

CHANGELOG entry: Fixed Perps tutorial taking over 5 seconds to load

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/TAT-1840

Manual testing steps

Feature: Perps Tutorial Loading Performance

  Scenario: First-time user navigates to tutorial
    Given user is a first-time Perps user
    When user taps "Trade" button from wallet actions
    Then tutorial displays instantly without "Connecting to perps" screen
    And WebSocket connection initializes in background

  Scenario: Tutorial to Markets navigation
    Given user is viewing tutorial
    When user completes or skips tutorial
    Then user navigates to Markets view
    And Markets loads with active WebSocket connection

  Scenario: Deeplink to tutorial for first-time user
    Given user is a first-time Perps user
    When user opens perps deeplink
    Then tutorial displays instantly

Screenshots/Recordings

Before

  • Tutorial showed "Connecting to perps" loading screen for 5+ seconds

After

  • Tutorial displays instantly
  • Connection establishes in background during tutorial (no loader ever displayed since now connected when reaching marketlist screen)
Screen.Recording.2025-10-08.at.1.28.05.PM.mov

Pre-merge author checklist

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.

Technical Details

Files changed:

  • MainNavigator.js: Added Tutorial as sibling to PERPS.ROOT
  • routes/index.tsx: Removed Tutorial from PerpsScreenStack
  • PerpsTutorialCarousel.tsx: Added background connection initialization
  • Navigation updates: handlePerpsUrl.ts, WalletActions.tsx, TradeWalletActions.tsx, PerpsGTMModal.tsx, WaysToEarn.tsx, PerpsTabView.tsx

Navigation patterns:

  • Tutorial: Direct navigate(Routes.PERPS.TUTORIAL) (app level)
  • Markets/other: Nested navigate(Routes.PERPS.ROOT, { screen: Routes.PERPS.MARKETS }) (inside provider)

Note

Moves Perps tutorial to app-level navigation and initializes the perps connection in the background; updates all navigation calls and related tests.

  • Navigation:
    • Move Routes.PERPS.TUTORIAL out of PerpsScreenStack into MainNavigator and remove it from UI/Perps/routes.
    • Update callers to navigate directly to Routes.PERPS.TUTORIAL (first-time users) and keep nested Routes.PERPS.ROOT for markets/others:
      • PerpsTabView, WalletActions, TradeWalletActions, Rewards/WaysToEarn, PerpsGTMModal, handlePerpsUrl.
  • Tutorial:
    • PerpsTutorialCarousel: start background connection via PerpsConnectionManager.connect() with debug logging; minor view cleanup.
    • Export PerpsTutorialCarousel from UI/Perps/index for app-level use.
  • Tests:
    • Adjust expectations to direct navigate(Routes.PERPS.TUTORIAL) across updated specs (PerpsTabView, GTM modal, Rewards WaysToEarn, WalletActions, deeplink handler).

Written by Cursor Bugbot for commit 6aade3b. This will update automatically on new commits. Configure here.

@github-actions

github-actions Bot commented Oct 8, 2025

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.

@metamaskbot metamaskbot added team-perps Perps team INVALID-PR-TEMPLATE PR's body doesn't match template labels Oct 8, 2025
@github-actions github-actions Bot added the size-M label Oct 8, 2025
@abretonc7s abretonc7s marked this pull request as ready for review October 8, 2025 05:03
@abretonc7s abretonc7s requested review from a team as code owners October 8, 2025 05:03
cursor[bot]

This comment was marked as outdated.

@abretonc7s abretonc7s requested a review from a team as a code owner October 8, 2025 05:07
cursor[bot]

This comment was marked as outdated.

@abretonc7s abretonc7s changed the title Feat/perps/optimize connection fix(perps): remove loading delay from tutorial screen Oct 8, 2025
cursor[bot]

This comment was marked as outdated.

@abretonc7s abretonc7s enabled auto-merge October 8, 2025 15:15
@abretonc7s abretonc7s added the skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. label Oct 8, 2025
@metamaskbot metamaskbot removed the INVALID-PR-TEMPLATE PR's body doesn't match template label Oct 8, 2025
gambinish
gambinish previously approved these changes Oct 9, 2025
@abretonc7s abretonc7s added the No QA Needed Apply this label when your PR does not need any QA effort. label Oct 9, 2025
@abretonc7s abretonc7s requested a review from gambinish October 9, 2025 06:26
@nickewansmith nickewansmith added the skip-e2e skip E2E test jobs label Oct 9, 2025
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
70.6% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@abretonc7s abretonc7s added this pull request to the merge queue Oct 10, 2025
Merged via the queue into main with commit 3d3f00e Oct 10, 2025
55 of 56 checks passed
@abretonc7s abretonc7s deleted the feat/perps/optimize-connection branch October 10, 2025 00:56
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 10, 2025
@metamaskbot metamaskbot added the release-7.58.0 Issue or pull request that will be included in release 7.58.0 label Oct 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

No QA Needed Apply this label when your PR does not need any QA effort. release-7.58.0 Issue or pull request that will be included in release 7.58.0 size-M skip-e2e skip E2E test jobs skip-sonar-cloud Only used for bypassing sonar cloud when failures are not relevant to the changes. team-perps Perps team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants