Skip to content

Conversation

@mcayuelas-ledger
Copy link
Contributor

@mcayuelas-ledger mcayuelas-ledger commented Dec 31, 2025

✅ Checklist

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

📝 Description

This PR fixes a navigation bug where retrying after a device error (e.g., locked device) in the receive flow would redirect to the wallet page. The fix uses navigate() instead of replace() to preserve the device selection screen in the stack, allowing proper retry navigation. A navigationDepth parameter is introduced to correctly close inline flows, with integration tests added to validate the behavior.

Add forwardRef support to ReanimatedSwipeable mock for proper ref handling in integration tests.

Screen.Recording.2026-01-12.at.11.08.45.mov

❓ 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)

@vercel
Copy link

vercel bot commented Dec 31, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

4 Skipped Deployments
Project Deployment Review Updated (UTC)
ledger-live-github-bot Ignored Ignored Preview Jan 12, 2026 10:15am
native-ui-storybook Ignored Ignored Preview Jan 12, 2026 10:15am
react-ui-storybook Ignored Ignored Preview Jan 12, 2026 10:15am
web-tools Ignored Ignored Preview Jan 12, 2026 10:15am

@live-github-bot live-github-bot bot added the mobile Has changes in LLM label Dec 31, 2025
@mcayuelas-ledger mcayuelas-ledger marked this pull request as ready for review December 31, 2025 09:25
@mcayuelas-ledger mcayuelas-ledger requested a review from a team as a code owner December 31, 2025 09:25
Copilot AI review requested due to automatic review settings December 31, 2025 09:25
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 fixes a navigation bug in the receive flow where clicking retry after a device error (e.g., locked device) would incorrectly redirect users to the wallet page instead of returning them to the device selection screen. The fix changes navigation from replace() to navigate() to preserve the device selection screen in the navigation stack, and introduces a navigationDepth parameter to properly close inline flows.

Key Changes

  • Replaced replace() with navigate() in device selection to keep SelectDevice in the navigation stack for retry scenarios
  • Added navigationDepth parameter to track how many screens to pop when closing inline flows
  • Updated retry logic to navigate back to device selection for inline flows with errors
  • Added integration tests to validate retry behavior and inline flow closure

Reviewed changes

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

Show a summary per file
File Description
useSelectDeviceViewModel.ts Changed from replace() to navigate() to preserve device selection screen in stack for retry navigation
useDeviceNavigation.ts Added navigationDepth calculation (value of 2 for inline flows) to track navigation stack depth
types.ts (DeviceSelection) Added optional navigationDepth parameter to CommonParams type
types.ts (AddAccount) Added optional navigationDepth parameter with documentation comment
useScanDeviceAccountsViewModel.ts Updated retry logic to navigate back for inline errors, added closeInlineFlow function using navigationDepth
addAccountFlow.test.tsx Added integration tests for device lock retry and navigationDepth-based flow closure
ReanimatedSwipeable.js Added forwardRef support and displayName to mock component
ninety-bags-taste.md Added changeset describing the fix

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings December 31, 2025 09:50
@github-actions
Copy link
Contributor

github-actions bot commented Dec 31, 2025

⚠️ 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/retry-nav-mad
  • Device: nanoX

@mcayuelas-ledger mcayuelas-ledger force-pushed the fix/retry-nav-mad branch 3 times, most recently from d175642 to 5898130 Compare December 31, 2025 09:54
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

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@live-github-bot
Copy link
Contributor

live-github-bot bot commented Dec 31, 2025

Desktop Bundle Checks

Comparing 240b221 against 4be5dba.

⚠️ @babel/runtime/helpers/esm/objectWithoutPropertiesLoose library is now duplicated in renderer (regression)
⚠️ redux library is now duplicated in renderer (regression)
⚠️ @babel/runtime/helpers/esm/objectSpread2 library is now duplicated in renderer (regression)
🚀 react-redux library is no longer duplicated in renderer
🚀 @reduxjs/toolkit library is no longer duplicated in renderer

Mobile Bundle Checks

Comparing 175e6d8 against 8582d72.

✅ Previous issues have all been fixed.

Copilot AI review requested due to automatic review settings December 31, 2025 10:55
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

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

LucasWerey
LucasWerey previously approved these changes Jan 5, 2026
Copilot AI review requested due to automatic review settings January 6, 2026 08:25
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

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gre-ledger
Copy link
Contributor

Please consider rebasing this PR with develop as the PR includes tests and we should ensure they still pass on Jest 30 (as some API may have changed in Jest #13396 )

Copilot AI review requested due to automatic review settings January 9, 2026 16:53
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

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +222 to +272
it("should return to device selection on retry when device is locked in inline flow", async () => {
const { user, getByText, queryByText, getByTestId } = render(
<ModularDrawerSharedNavigator flow="not_add_account" />,
);

// Navigate through the add account flow
expect(getByText(WITH_ACCOUNT_SELECTION)).toBeVisible();
await user.press(getByText(WITH_ACCOUNT_SELECTION));
advanceTimers();

expect(getByText(/bitcoin/i)).toBeVisible();
await user.press(getByText(/bitcoin/i));
advanceTimers();

expect(getByText(/add new or existing account/i)).toBeVisible();
await user.press(getByText(/add new or existing account/i));
advanceTimers();

expect(getByText(/connect device/i)).toBeVisible();
advanceTimers();

const deviceItem = getByText(/ledger stax/i);
expect(deviceItem).toBeVisible();
await user.press(deviceItem);
advanceTimers();

// Wait for scanning to start
await waitFor(() => {
expect(getByText(/checking the blockchain/i)).toBeVisible();
});

// Trigger device locked error
await act(() => {
triggerError?.(new Error("Device locked"));
});

// Wait for error modal to appear
await waitFor(() => {
expect(queryByText("Device locked")).toBeVisible();
});

// Click Retry button (only Retry has testID="proceed-button", not Cancel)
const retryButton = getByTestId("proceed-button");
await user.press(retryButton);

// Should return to device selection screen (not to wallet)
await waitFor(() => {
expect(getByText(/connect device/i)).toBeVisible();
expect(queryByText(/checking the blockchain/i)).not.toBeVisible();
});
});
Copy link

Copilot AI Jan 9, 2026

Choose a reason for hiding this comment

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

The test suite only validates retry behavior for inline flows. Consider adding a test case for the retry behavior in non-inline flows (when inline is false) to ensure restartSubscription is called correctly in that scenario.

Copilot uses AI. Check for mistakes.
@sonarqubecloud
Copy link

@mcayuelas-ledger mcayuelas-ledger merged commit 54ef33a into develop Jan 13, 2026
63 of 65 checks passed
@mcayuelas-ledger mcayuelas-ledger deleted the fix/retry-nav-mad branch January 13, 2026 10:01
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.

4 participants