Skip to content

fix: cp-7.66.0 refresh staked balance after account switch#26332

Merged
salimtb merged 3 commits into
mainfrom
fix/refresh-staked-balance-after-account-switch
Feb 20, 2026
Merged

fix: cp-7.66.0 refresh staked balance after account switch#26332
salimtb merged 3 commits into
mainfrom
fix/refresh-staked-balance-after-account-switch

Conversation

@salimtb

@salimtb salimtb commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Description

fix refresh staking balance after account switch

Changelog

CHANGELOG entry: fix refresh staking balance after account switch

Related issues

Fixes: #26323

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

before.mov

After

after-stake.mov

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

Medium Risk
Touches wallet balance refresh triggering, which could affect when/ how often balances are refreshed after navigation or account changes; test coverage reduces regression risk but performance/extra refreshes should be watched.

Overview
Ensures wallet balance refresh runs after an account switch by adding selectedInternalAccount to the dependency list that triggers AccountTrackerController.refresh in Wallet.

Updates Wallet tests to cover the new refresh-on-account-change behavior (using waitFor and a rerender with a different AccountsController.internalAccounts.selectedAccount) and refreshes related snapshots.

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

@github-actions

Copy link
Copy Markdown
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.

@salimtb salimtb changed the title fix: refresh staked balance after account switch fix: cp-7.66.0 refresh staked balance after account switch Feb 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeAccounts, SmokeWalletPlatform
  • Selected Performance tags: @PerformanceAccountList, @PerformanceAssetLoading
  • Risk Level: medium
  • AI Confidence: 85%
click to see 🤖 AI reasoning details

E2E Test Selection:
The PR adds selectedInternalAccount to the dependency array of a useEffect hook in the main Wallet component that triggers AccountTrackerController.refresh(). This is a bug fix ensuring account balances are properly refreshed when the user switches accounts.

Impact Analysis:

  1. Main Wallet View: The change is in the core Wallet component (app/components/Views/Wallet/index.tsx) which is the main home screen
  2. Account Switching: Adding selectedInternalAccount as a dependency ensures balance refresh triggers on account changes
  3. AccountTrackerController: This controller manages account balance tracking across networks

Tag Selection Rationale:

  • SmokeAccounts: Directly relevant as it tests account switching, multi-account management, and account selection workflows. The fix ensures balances update correctly when switching between accounts.
  • SmokeWalletPlatform: Relevant because it tests core wallet platform features including transaction history display and wallet lifecycle. The Wallet component is central to these tests.

Risk Assessment (Medium):

  • The change is a targeted dependency array fix with a corresponding unit test
  • It affects core wallet functionality but is a straightforward fix
  • The snapshot changes are just test artifact updates (handler tag increments)
  • No breaking changes to component interfaces or props

Performance Test Selection:
The change affects account switching behavior and balance refresh timing. Adding selectedInternalAccount to the useEffect dependency array means AccountTrackerController.refresh() will now be called when switching accounts, which could impact: 1) Account list rendering performance when switching accounts (@PerformanceAccountList), and 2) Asset/balance loading performance since the refresh is triggered on account changes (@PerformanceAssetLoading). These tests will help verify the change doesn't introduce performance regressions in account switching and balance loading flows.

View GitHub Actions results

@salimtb salimtb marked this pull request as ready for review February 20, 2026 13:43
@sonarqubecloud

Copy link
Copy Markdown

@salimtb salimtb enabled auto-merge February 20, 2026 13:53
@salimtb salimtb added this pull request to the merge queue Feb 20, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Comment thread app/components/Views/Wallet/index.test.tsx
Merged via the queue into main with commit c70f38d Feb 20, 2026
98 checks passed
@salimtb salimtb deleted the fix/refresh-staked-balance-after-account-switch branch February 20, 2026 14:12
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 20, 2026
@metamaskbot metamaskbot added the release-7.68.0 Issue or pull request that will be included in release 7.68.0 label Feb 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.68.0 Issue or pull request that will be included in release 7.68.0 size-S team-assets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]:Staked ETH balances are not updating consistently when switching accounts.

4 participants