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

refactor: remove UI initialisation callbacks #26969

Merged
merged 1 commit into from
Sep 10, 2024

Conversation

matthewwalsh0
Copy link
Member

@matthewwalsh0 matthewwalsh0 commented Sep 6, 2024

Description

Replace legacy callback chain in UI initialisation with promises and async functions to improve readability and simplify maintenance.

Also removes some duplication in MV3 and legacy code.

Open in GitHub Codespaces

Related issues

Manual testing steps

No functional changes.

Screenshots/Recordings

Before

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.

@matthewwalsh0 matthewwalsh0 added the team-tiger Tiger team (for tech debt reduction + performance improvements) label Sep 6, 2024
@matthewwalsh0 matthewwalsh0 requested a review from a team as a code owner September 6, 2024 13:31
Copy link

sonarcloud bot commented Sep 6, 2024

@matthewwalsh0 matthewwalsh0 added the team-confirmations Push issues to confirmations team label Sep 6, 2024
if (isManifestV3 && isUIInitialised) {
// Currently when service worker is revived we create new streams
// in later version we might try to improve it by reviving same streams.
updateUiStreams();
Copy link
Member Author

Choose a reason for hiding this comment

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

My understanding is that we can now be certain the service worker will never restart while the browser is open, meaning this logic and the resetExtensionStreamAndListeners branch below is superfluous.

But for the sake of keeping this PR as a pure refactor with no functional changes, I've left it for now.

@metamaskbot
Copy link
Collaborator

Builds ready [2918681]
Page Load Metrics (1937 ± 246 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint27738811796713342
domContentLoaded148938541905504242
load149738751937512246
domInteractive21211444320
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: -200 Bytes (-0.00%)
  • common: 0 Bytes (0.00%)

Copy link

codecov bot commented Sep 6, 2024

Codecov Report

Attention: Patch coverage is 0% with 94 lines in your changes missing coverage. Please review.

Project coverage is 70.19%. Comparing base (7ec7a45) to head (2918681).
Report is 5 commits behind head on develop.

Files with missing lines Patch % Lines
app/scripts/ui.js 0.00% 74 Missing ⚠️
ui/index.js 0.00% 20 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #26969      +/-   ##
===========================================
+ Coverage    70.17%   70.19%   +0.02%     
===========================================
  Files         1425     1425              
  Lines        49647    49639       -8     
  Branches     13889    13886       -3     
===========================================
+ Hits         34836    34842       +6     
+ Misses       14811    14797      -14     

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

@matthewwalsh0 matthewwalsh0 merged commit e858167 into develop Sep 10, 2024
91 of 93 checks passed
@matthewwalsh0 matthewwalsh0 deleted the refactor/ui-init-promises branch September 10, 2024 09:50
@github-actions github-actions bot locked and limited conversation to collaborators Sep 10, 2024
@metamaskbot metamaskbot added the release-12.6.0 Issue or pull request that will be included in release 12.6.0 label Sep 10, 2024
@gauthierpetetin gauthierpetetin added release-12.5.0 Issue or pull request that will be included in release 12.5.0 and removed release-12.6.0 Issue or pull request that will be included in release 12.6.0 labels Sep 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.5.0 Issue or pull request that will be included in release 12.5.0 team-confirmations Push issues to confirmations team team-tiger Tiger team (for tech debt reduction + performance improvements)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants