Skip to content

fix(settings): handle invalid session token on sign out#20529

Open
vpomerleau wants to merge 1 commit intomainfrom
FXA-13685
Open

fix(settings): handle invalid session token on sign out#20529
vpomerleau wants to merge 1 commit intomainfrom
FXA-13685

Conversation

@vpomerleau
Copy link
Copy Markdown
Contributor

Because

  • If the session token no longer exists on the server, sessionDestroy returns 401/errno 110 and the avatar-menu toast strands the user with stale local state.

This pull request

  • Swallows errno 110 in Session.destroy() so local cleanup and redirect proceed. Other errors still surface the toast.
  • Adds tests for Session.destroy().

Issue that this pull request solves

Closes: FXA-13685

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)

  • Key files/areas to focus on:
  • Suggested review order:
  • Risky or complex parts:

Screenshots (Optional)

Please attach the screenshots of the changes made in case of change in user interface.

Other information (Optional)

Any other information that is important to this pull request.

Because:
- If the session token no longer exists on the server, sessionDestroy returns 401/errno 110 and
  the avatar-menu toast strands the user with stale local state.

This commit:
- Swallows errno 110 in Session.destroy() so local cleanup and
  redirect proceed. Other errors still surface the toast.
- Adds tests for Session.destroy().

Closes #FXA-13685
Copilot AI review requested due to automatic review settings May 6, 2026 18:39
@vpomerleau vpomerleau requested a review from a team as a code owner May 6, 2026 18:39
Copy link
Copy Markdown
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 updates the fxa-settings sign-out/session teardown path so that local sign-out cleanup still completes when the server reports the session token is already invalid (401 / errno 110), avoiding users being stranded with stale local state.

Changes:

  • Swallow ERRNO.INVALID_TOKEN errors from authClient.sessionDestroy() so local cleanup + redirect can proceed.
  • Add unit tests covering success, INVALID_TOKEN, other failures, and “no session token” behavior for Session.destroy().

Reviewed changes

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

File Description
packages/fxa-settings/src/models/Session.ts Catch and ignore ERRNO.INVALID_TOKEN from sessionDestroy while preserving rethrow behavior for all other errors.
packages/fxa-settings/src/models/Session.test.ts Adds coverage for the new destroy() error-handling behavior and existing cleanup semantics.

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

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.

2 participants