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: Prevent BadgeStatus' tooltip from rerendering #30874

Merged
merged 1 commit into from
Mar 8, 2025

Conversation

darkwing
Copy link
Contributor

@darkwing darkwing commented Mar 7, 2025

Description

The Tooltip in this component re-renders for two reasons:

  1. The { display: 'flex' } is a new object
  2. The child contents of the tooltip are different despite the objects looking the same

By memoizing the child element, the Tooltip doesn't frequently re-render

Open in GitHub Codespaces

Related issues

Fixes:

Manual testing steps

  1. Checkout main branch
  2. Start the extension with ENABLE_WHY_DID_YOU_RENDER enabled
  3. Open the account list menu
  4. See loads of re-renders of tooltips in the BadgeStatus component
  5. Checkout this branch
  6. Start the extension with ENABLE_WHY_DID_YOU_RENDER enabled
  7. Open the account list menu
  8. Don't see all of the re-renders

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.

@darkwing darkwing requested a review from a team as a code owner March 7, 2025 21:38
Copy link
Contributor

github-actions bot commented Mar 7, 2025

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.

@darkwing darkwing changed the title Prevent BadgeStatus' tooltip from rerendering fix: Prevent BadgeStatus' tooltip from rerendering Mar 7, 2025
@metamaskbot
Copy link
Collaborator

Builds ready [de6574d]
Page Load Metrics (2151 ± 141 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint52325222045441212
domContentLoaded161524202065253121
load165626402151293141
domInteractive2910442178
backgroundConnect17353887636
firstReactRender1488332110
getState7123423316
initialActions01000
loadScripts12151882158920598
setupStore85516126
uiStartup188440572571550264
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 617 Bytes (0.01%)
  • common: 0 Bytes (0.00%)

Copy link
Contributor

@vinnyhoward vinnyhoward left a comment

Choose a reason for hiding this comment

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

LGTM

@darkwing darkwing added this pull request to the merge queue Mar 8, 2025
Merged via the queue into main with commit 435e553 Mar 8, 2025
81 of 82 checks passed
@darkwing darkwing deleted the memoize-badge-status branch March 8, 2025 02:28
@github-actions github-actions bot locked and limited conversation to collaborators Mar 8, 2025
@metamaskbot metamaskbot added the release-12.15.0 Issue or pull request that will be included in release 12.15.0 label Mar 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-12.15.0 Issue or pull request that will be included in release 12.15.0 team-wallet-ux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants