Skip to content

fix(pairing): navigate once when the supplicant connects - #21259

Open
dschom wants to merge 2 commits into
mainfrom
FXA-14566
Open

dschom wants to merge 2 commits into
mainfrom
FXA-14566

Conversation

@dschom

@dschom dschom commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Because

  • Tapping Connect on the v2 mobile supplicant routed to the "One last step to sync" screen twice, pushing a duplicate history entry that dropped the query string.
  • Failures on channel open and on approval also routed twice, once from the integration's own Failed state and again from the promise catch.

This pull request

  • Drops the then navigation in the Connect handler; the WaitingForAuthority state change is the single navigation to approve_signin.
  • Routes both catch paths through navigateWithQuery with replace, and only when the integration has not already moved to Failed.
  • Passes { replace: true } for the approve_signin navigation and the shared error handler, so neither adds a history entry.
  • Removes the unused useNavigate from the container.
  • Adds container tests asserting exactly one navigation for the success path and each failure path.

Issue that this pull request solves

Closes: FXA-14566

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).
  • I have manually reviewed all AI generated code.

How to review (Optional)

This one is something Claude called out while working on #21256. The gap appears to be valid though. The verification has been 'pushed' left, and tests have been updated ensure a double navigation has not occurred.

Screenshots (Optional)

Other information (Optional)

The ticket's acceptance criteria only cover the Connect handler. The channel-open catch and the Failed-state guard go a step further since they share the same double-navigation cause.

The catch still routes for rejections that bypass the integration's fail(), such as a channel torn down by a concurrent Cancel, since no state change fires in that case.

navigateWithQuery's third positional argument is includeHash, not replace. The other Pair2 pages pass {}, true where they mean replace, so their navigations are pushes too. Only this container's calls are changed here; the rest belongs in a follow-up.

Because:

- Tapping Connect on the v2 supplicant routed to approve_signin twice:
  once from the WaitingForAuthority state change and again from the
  approval promise, which pushed a duplicate entry without the query.
- Failures on channel open and approval routed a second time from the
  catch after the integration's own Failed state had already routed.

This commit:

- Drops the then-branch navigation and lets the state handler route.
- Routes both catch paths through navigateWithQuery with replace, and
  only when the integration did not already fail itself.
- Removes the now-unused useNavigate from the container.
- Asserts exactly one navigation for the success and failure paths.

Fixes FXA-14566
Because:

- navigateWithQuery's third positional argument is includeHash, not
  replace, so the approve_signin and timeout navigations were pushes
  even though the flow treats them as replacements.

This commit:

- Passes { replace: true } for the approve_signin navigation and for
  the error handler added in the previous commit.
- Updates the container tests to the new call shape.
@dschom
dschom marked this pull request as ready for review September 19, 2026 00:02
@dschom
dschom requested a review from a team as a code owner September 19, 2026 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant