Skip to content

refactor: remove ScreenComponent any cast from Perps routes#28116

Merged
asalsys merged 5 commits intomainfrom
refactor/remove-screen-component-any-perps
Mar 31, 2026
Merged

refactor: remove ScreenComponent any cast from Perps routes#28116
asalsys merged 5 commits intomainfrom
refactor/remove-screen-component-any-perps

Conversation

@asalsys
Copy link
Copy Markdown
Contributor

@asalsys asalsys commented Mar 30, 2026

Description

Simplify the PerpsConfirmScreen wrapper to rely solely on useRoute() hook (which it was already using), removing the redundant route prop type and the type ScreenComponent = React.ComponentType<any> escape hatch.

Part of the React Navigation v6 migration effort to remove no-explicit-any violations from route files.

Changes:

  • routes/index.tsx: Remove route from PerpsConfirmScreen props, rely on useRoute() only. Remove ScreenComponent type alias and as ScreenComponent cast.

Changelog

CHANGELOG entry: null

Related issues

Fixes:

Manual testing steps

N/A — pure refactoring with no user-facing behavior change.

Screenshots/Recordings

Before

N/A

After

N/A

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.

Made with Cursor


Note

Low Risk
Low risk refactor limited to React Navigation wiring and TypeScript types; behavior should remain the same aside from how showPerpsHeader is read from route params.

Overview
Simplifies PerpsConfirmScreen to no longer accept/forward navigation props and instead read showPerpsHeader directly from useRoute() params when rendering Confirm.

Removes the ScreenComponent = React.ComponentType<any> escape hatch and the as ScreenComponent cast in the stack screen registration, improving typing as part of the React Navigation v6 migration.

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

@asalsys asalsys self-assigned this Mar 30, 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.

@metamaskbot metamaskbot added the team-mobile-platform Mobile Platform team label Mar 30, 2026
@asalsys asalsys marked this pull request as ready for review March 31, 2026 14:12
@asalsys asalsys requested a review from a team as a code owner March 31, 2026 14:12
Base automatically changed from feat/react-navigation-v6-migration to main March 31, 2026 15:02
@andrepimenta andrepimenta requested review from a team as code owners March 31, 2026 15:02
@github-actions github-actions bot added the risk-medium Moderate testing recommended · Possible bug introduction risk label Mar 31, 2026
Simplify PerpsConfirmScreen to rely solely on useRoute() hook,
removing the redundant route prop type and the
type ScreenComponent = React.ComponentType<any> escape hatch.

Made-with: Cursor
@asalsys asalsys force-pushed the refactor/remove-screen-component-any-perps branch from bc64a87 to 7d24b49 Compare March 31, 2026 15:15
@github-actions github-actions bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Mar 31, 2026
@asalsys
Copy link
Copy Markdown
Contributor Author

asalsys commented Mar 31, 2026

Closing: rebasing onto main since the navigation v6 branch was merged.

@asalsys asalsys removed request for a team March 31, 2026 15:29
@github-actions github-actions bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Mar 31, 2026
@github-actions github-actions bot locked and limited conversation to collaborators Mar 31, 2026
@asalsys asalsys reopened this Mar 31, 2026
@github-actions github-actions bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Mar 31, 2026
@asalsys asalsys removed the risk-medium Moderate testing recommended · Possible bug introduction risk label Mar 31, 2026
@github-actions github-actions bot added the risk-medium Moderate testing recommended · Possible bug introduction risk label Mar 31, 2026
@MetaMask MetaMask unlocked this conversation Mar 31, 2026
@github-actions github-actions bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Mar 31, 2026
Copy link
Copy Markdown

@cursor cursor bot left a comment

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 1 potential issue.

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.

@github-actions github-actions bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Mar 31, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePerps, SmokeWalletPlatform, SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 90%
click to see 🤖 AI reasoning details

E2E Test Selection:
The change is a focused refactoring/bug fix in app/components/UI/Perps/routes/index.tsx:

  1. Bug fix: params?.params?.showPerpsHeaderparams?.showPerpsHeader — the double .params nesting was incorrect and likely caused showPerpsHeader to always be undefined, meaning the Perps confirmation header was never shown correctly.

  2. Simplification: PerpsConfirmScreen now uses useRoute() directly instead of accepting forwarded props, and the TypeScript cast workaround was removed.

  3. Scope: Entirely within the Perps feature's navigation/routing layer, specifically affecting the confirmation screen header display.

Tags selected:

  • SmokePerps: Directly tests the Perps feature including Add Funds flow and balance verification — the confirmation screen is part of this flow.
  • SmokeWalletPlatform: Per tag description, Perps is a section inside the Trending tab; changes to Perps views affect Trending.
  • SmokeConfirmations: Per SmokePerps tag description, "Add Funds deposits are on-chain transactions" requiring confirmations — and the changed component is literally the Perps confirmation screen wrapper.

No performance impact expected from this change (it's a routing/component simplification with no rendering overhead changes).

Performance Test Selection:
The change is a minor refactoring of the PerpsConfirmScreen component — removing a type alias, fixing a params nesting bug, and simplifying prop handling. There are no changes to rendering logic, list components, data fetching, or state management that would impact performance metrics. No performance tests are warranted.

View GitHub Actions results

@github-actions
Copy link
Copy Markdown
Contributor

E2E Fixture Validation — Schema is up to date
17 value mismatches detected (expected — fixture represents an existing user).
View details

@sonarqubecloud
Copy link
Copy Markdown

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.73.0 Issue or pull request that will be included in release 7.73.0 risk-medium Moderate testing recommended · Possible bug introduction risk size-S team-mobile-platform Mobile Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants