Skip to content

Conversation

@runway-github
Copy link
Contributor

@runway-github runway-github bot commented Oct 24, 2025

Description

This PR fixes a bug where an error would display for users who's token
has expired. Now they are silently logged out instead of throwing an
error that is displayed to the user.

Changelog

CHANGELOG entry: fixed bug where an error message was incorrectly
displayed to the user on the deposit page

Related issues

Fixes:
#21642

Manual testing steps

Feature:  User Error Fix

  Scenario: logged-out user should not see error message
    Given user token has expired
    When user visits the deposit page
    Then user should not see an error

Screenshots/Recordings

Before

Screenshot 2025-10-24 at 11 58 22 AM

After

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.

Note

Stops rethrowing 401 errors in useDepositUser by logging out silently; updates tests to reflect non-throwing behavior on 401.

  • Hook (useDepositUser)
    • On 401 from fetchUserDetails, log and call logoutFromProvider(false) without rethrowing.
    • Only rethrow non-401 errors.
  • Tests (useDepositUser.test.ts)
    • Update 401 test to expect silent logout and no thrown error.
    • Adjust setup to not provide stale data during 401 case.

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

Co-authored-by: Pedro Pablo Aste Kompen [email protected] 3f30cb5

…er details fetch is 401 (#21633)

<!--
Please submit this PR as a draft initially.
Do not mark it as "Ready for review" until the template has been
completely filled out, and PR status checks have passed at least once.
-->

## **Description**

This PR fixes a bug where an error would display for users who's token
has expired. Now they are silently logged out instead of throwing an
error that is displayed to the user.


<!--
Write a short description of the changes included in this pull request,
also include relevant motivation and context. Have in mind the following
questions:
1. What is the reason for the change?
2. What is the improvement/solution?
-->

## **Changelog**

<!--
If this PR is not End-User-Facing and should not show up in the
CHANGELOG, you can choose to either:
1. Write `CHANGELOG entry: null`
2. Label with `no-changelog`

If this PR is End-User-Facing, please write a short User-Facing
description in the past tense like:
`CHANGELOG entry: Added a new tab for users to see their NFTs`
`CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker`

(This helps the Release Engineer do their job more quickly and
accurately)
-->

CHANGELOG entry: fixed bug where an error message was incorrectly
displayed to the user on the deposit page

## **Related issues**

Fixes:
#21642


## **Manual testing steps**

```gherkin
Feature:  User Error Fix

  Scenario: logged-out user should not see error message
    Given user token has expired
    When user visits the deposit page
    Then user should not see an error
```

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**
<img width="509" height="897" alt="Screenshot 2025-10-24 at 11 58 22 AM"
src="https://github.com/user-attachments/assets/7e771356-f54e-4208-af21-8eb2004d017c"
/>



<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [x] I’ve followed [MetaMask Contributor
Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile
Coding
Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md).
- [x] I've completed the PR template to the best of my ability
- [x] I’ve included tests if applicable
- [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [x] I’ve applied the right labels on the PR (see [labeling
guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)).
Not required for external contributors.

## **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.


<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> `useDepositUser` now logs out without throwing on 401 while still
throwing for non-401 errors; tests updated to reflect new behavior.
> 
> - **Hooks**:
> - `useDepositUser`: On `401`, log and call `logoutFromProvider(false)`
without rethrowing; other errors continue to throw.
> - **Tests**:
> - Update 401 test to expect no throw and verify logout call; minor
setup adjustments to align with new behavior.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
54d5e23. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: Pedro Pablo Aste Kompen <[email protected]>
@runway-github runway-github bot requested a review from a team as a code owner October 24, 2025 21:04
@github-actions
Copy link
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-bots Bot team (for MetaMask Bot, Runway Bot, etc.) label Oct 24, 2025
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (release/7.58.0@96c3303). Learn more about missing BASE report.

Additional details and impacted files
@@                Coverage Diff                @@
##             release/7.58.0   #21648   +/-   ##
=================================================
  Coverage                  ?   77.25%           
=================================================
  Files                     ?     3643           
  Lines                     ?    89850           
  Branches                  ?    17073           
=================================================
  Hits                      ?    69413           
  Misses                    ?    15734           
  Partials                  ?     4703           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sonarqubecloud
Copy link

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

Labels

size-S team-bots Bot team (for MetaMask Bot, Runway Bot, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants