Skip to content

fix(live-27196): use useOpenSwap for market/accounts/assets swap navigation#15043

Open
liviuciulinaru wants to merge 1 commit intodevelopfrom
fix/live-27196/lwm40-nav-bars
Open

fix(live-27196): use useOpenSwap for market/accounts/assets swap navigation#15043
liviuciulinaru wants to merge 1 commit intodevelopfrom
fix/live-27196/lwm40-nav-bars

Conversation

@liviuciulinaru
Copy link
Contributor

@liviuciulinaru liviuciulinaru commented Mar 4, 2026

✅ Checklist

  • npx changeset was attached.
  • Covered by automatic tests.
  • Impact of the changes:
    • ...

📝 Description

  • use useOpenSwap for market/accounts/assets
swap.navbar.mp4

❓ Context


🧐 Checklist for the PR Reviewers

  • The code aligns with the requirements described in the linked JIRA or GitHub issue.
  • The PR description clearly documents the changes made and explains any technical trade-offs or design decisions.
  • There are no undocumented trade-offs, technical debt, or maintainability issues.
  • The PR has been tested thoroughly, and any potential edge cases have been considered and handled.
  • Any new dependencies have been justified and documented.
  • Performance considerations have been taken into account. (changes have been profiled or benchmarked if necessary)

@liviuciulinaru liviuciulinaru requested review from a team as code owners March 4, 2026 15:50
Copilot AI review requested due to automatic review settings March 4, 2026 15:50
@live-github-bot live-github-bot bot added the mobile Has changes in LLM label Mar 4, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

⚠️ E2E tests are required

Changes detected require e2e testing before merge (even before asking for any review).

📱 Mobile

-> Run Mobile E2E

  • Select "Run workflow"
  • Branch: fix/live-27196/lwm40-nav-bars
  • Device: nanoX

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR standardizes Swap navigation across multiple entry points in Ledger Live Mobile by routing through the shared useOpenSwap hook, including support for preselecting an account/parent account when available.

Changes:

  • Update Account and Asset FAB actions to open Swap via useOpenSwap instead of hardcoded navigationParams.
  • Extend useOpenSwap to accept defaultAccount / defaultParentAccount and short-circuit navigation when provided.
  • Update Quick Actions swap CTA to use useOpenSwap for consistent navigation behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

File Description
apps/ledger-live-mobile/src/screens/Account/hooks/useAccountActions.tsx Use useOpenSwap as the Swap action handler on the Account screen.
apps/ledger-live-mobile/src/mvvm/features/Swap/index.ts Add optional defaultAccount/defaultParentAccount inputs and navigate directly when provided.
apps/ledger-live-mobile/src/mvvm/features/QuickActions/components/QuickActionsCtas/useQuickActionsCtasViewModel.ts Replace direct Swap navigation with handleOpenSwap() from useOpenSwap.
apps/ledger-live-mobile/src/components/FabActions/hooks/useAssetActions.tsx Use useOpenSwap for the Asset Swap action, deriving sourceScreenName from the current route.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 137 to +141
const handleOpenSwap = useCallback(() => {
if (defaultAccount && !isAccountEmpty(defaultAccount)) {
navigateToSwap(defaultAccount, defaultParentAccount);
return;
}
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

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

useOpenSwap now has a new early-return path when defaultAccount is provided and non-empty. The existing useOpenSwap tests don’t cover this new branch, so regressions in the account/assets entry points could slip in. Please add/extend tests to assert navigation params for both an Account and TokenAccount passed via defaultAccount (including defaultParentAccount handling) and that the account-selection drawer is not opened in this case.

Copilot generated this review using guidance from repository custom instructions.
@liviuciulinaru liviuciulinaru force-pushed the fix/live-27196/lwm40-nav-bars branch from bb126cc to 31bbe84 Compare March 4, 2026 16:11
@sonarqubecloud
Copy link

sonarqubecloud bot commented Mar 4, 2026

Quality Gate Failed Quality Gate failed

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

See analysis details on SonarQube Cloud

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

Labels

mobile Has changes in LLM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants