fix: fix side panel open tracking for multiple instances#40305
Merged
davidmurdoch merged 2 commits intomainfrom Feb 25, 2026
Merged
fix: fix side panel open tracking for multiple instances#40305davidmurdoch merged 2 commits intomainfrom
davidmurdoch merged 2 commits intomainfrom
Conversation
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. |
Contributor
Builds ready [d5055d6]
⚡ Performance Benchmarks (1459 ± 108 ms)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs
|
Contributor
Builds ready [2871366]
⚡ Performance Benchmarks (1361 ± 106 ms)
🌐 Dapp Page Load BenchmarksCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Bundle size diffs
|
NidhiKJha
approved these changes
Feb 24, 2026
ameliejyc
approved these changes
Feb 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Chrome can have multiple MetaMask side panel instances open at once (for example, across multiple browser windows).
background.jswas tracking side panel state with a singlesidePanelIsOpenboolean, which assumes only one instance exists.With a boolean, closing one side panel could incorrectly mark all side panels as closed.
That can cause premature environment cleanup and incorrect open-state checks while another side panel is still active.
Changelog
CHANGELOG entry: fixes syncing failure caused by the sidepanel being opened in multiple browser windows, and then one of the sidepanels being closed, causing syncing to stop.
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Small, localized logic change to UI instance bookkeeping in
background.jswith no auth, key-management, or data persistence changes; main risk is miscounting causing UI-open detection or cleanup to behave incorrectly.Overview
Fixes sidepanel open-state tracking in
background.jsby replacing the singlesidePanelIsOpenflag with anopenSidePanelCountcounter to correctly handle multiple simultaneous sidepanel instances.Open/close logic and related checks now key off the counter, including
isClientOpenstatus,trackAppOpenedgating,triggerUipopup suppression, and environment cleanup soonEnvironmentTypeClosed(ENVIRONMENT_TYPE_SIDEPANEL)only runs when the last sidepanel instance disconnects (avoiding premature polling/cleanup).Written by Cursor Bugbot for commit 2871366. This will update automatically on new commits. Configure here.