Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix background popup client connection count #23583

Merged
merged 5 commits into from
Mar 25, 2024

Conversation

jiexi
Copy link
Contributor

@jiexi jiexi commented Mar 19, 2024

Description

Currently it is possible to open more than one extension popup (the window that opens when you click on the extension icon from the browser toolbar), but background currently only considers it possible to have one open. This results in a bug where if two or more popups are open and one is closed, any ongoing gas fee polling will stop for all popups not just the one recently closed. This PR fixes this by changing the variable that tracks popup connection counts from a boolean to an int.

Open in GitHub Codespaces

Related issues

Fixes:

Manual testing steps

  1. Open two browser windows
  2. Open one extension popup
  3. In that popup, get to the confirmation screen for sending a transaction
  4. The gas fee should be updating periodically
  5. In the other window, open an extension popup
  6. The gas fee should be updating periodically
  7. Close any popup
  • NOTE: The gas fee will change to a very low number before updating back to the correct amount. This seems to be a separate bug
  1. The gas fee should be updating periodically still in the popup still open

Screenshots/Recordings

Before

After

Screen.Recording.2024-03-19.at.9.31.05.AM.mov

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

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.

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.

Copy link

sentry-io bot commented Mar 19, 2024

🔍 Existing Issues For Review

Your pull request is modifying functions with the following pre-existing issues:

📄 File: app/scripts/background.js

Function Unhandled Issue
setupController TypeError: Cannot read properties of undefined (reading 'getCurrentBlock') new exports.default(app/scrip...
Event Count: 18 Affected Users: 0
setupController Error: Account Id f32a1223-62f2-4fb1-9d37-f10cd4a8ad8f not found new MetamaskController(app/scripts/metamas...
Event Count: 1 Affected Users: 0

Did you find this useful? React with a 👍 or 👎

@metamaskbot
Copy link
Collaborator

Builds ready [499522d]
Page Load Metrics (1288 ± 538 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint712081213617
domContentLoaded115826136
load56289212881120538
domInteractive115826136
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 4 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@jiexi jiexi marked this pull request as ready for review March 20, 2024 00:18
@jiexi jiexi requested a review from a team as a code owner March 20, 2024 00:18
Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM!

@metamaskbot
Copy link
Collaborator

Builds ready [df03fb2]
Page Load Metrics (1043 ± 570 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint783821396933
domContentLoaded1279282010
load65312310431187570
domInteractive1279282010
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 4 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [f32046c]
Page Load Metrics (489 ± 391 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint652611155627
domContentLoaded1077302311
load542320489814391
domInteractive1077302311
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 4 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

Copy link

codecov bot commented Mar 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.82%. Comparing base (fc0e886) to head (f32046c).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop   #23583   +/-   ##
========================================
  Coverage    68.82%   68.82%           
========================================
  Files         1170     1170           
  Lines        44389    44389           
  Branches     11879    11879           
========================================
  Hits         30549    30549           
  Misses       13840    13840           

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

@jiexi jiexi merged commit b3d93fa into develop Mar 25, 2024
66 checks passed
@jiexi jiexi deleted the jl/fix-background-popup-background-polling branch March 25, 2024 18:08
@github-actions github-actions bot locked and limited conversation to collaborators Mar 25, 2024
@metamaskbot metamaskbot added release-11.14.1 Issue or pull request that will be included in release 11.14.1 release-11.14.0 Issue or pull request that will be included in release 11.14.0 and removed release-11.14.1 Issue or pull request that will be included in release 11.14.1 labels Mar 25, 2024
@metamaskbot
Copy link
Collaborator

Missing release label release-11.14.0 on PR. Adding release label release-11.14.0 on PR and removing other release labels(release-11.14.1), as PR was added to branch 11.14.0 when release was cut.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-11.14.0 Issue or pull request that will be included in release 11.14.0 team-wallet-api-platform
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants