Skip to content

Conversation

n3ps
Copy link
Contributor

@n3ps n3ps commented Sep 12, 2025

Description

Handle image load error on a dApp site's favicon

Open in GitHub Codespaces

Changelog

CHANGELOG entry: null

Related issues

Fixes: #35909

Manual testing steps

  1. Connect to a site with a known broken favicon
  2. It should fallback to first letter of that site

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.

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.

@n3ps n3ps marked this pull request as ready for review September 12, 2025 18:19
@n3ps n3ps requested a review from a team as a code owner September 12, 2025 18:19
@n3ps n3ps enabled auto-merge September 12, 2025 18:19
cursor[bot]

This comment was marked as outdated.

@metamaskbot
Copy link
Collaborator

metamaskbot commented Sep 12, 2025

✨ Files requiring CODEOWNER review ✨

🎨 @MetaMask/design-system-engineers (1 files, +37 -16)
  • 📁 ui/
    • 📁 components/
      • 📁 component-library/
        • 📁 avatar-favicon/
          • 📄 avatar-favicon.tsx +37 -16

@n3ps n3ps requested a review from a team as a code owner September 13, 2025 03:24
cursor[bot]

This comment was marked as outdated.

@@ -43,20 +77,7 @@ export const AvatarFavicon: AvatarFaviconComponent = React.forwardRef(
className={classnames('mm-avatar-favicon', className)}
{...{ borderColor, ...(props as AvatarBaseProps<C>) }}
>
{src ? (
Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. Extracted out

import { PolymorphicRef } from '../box';
import {
AvatarFaviconComponent,
AvatarFaviconProps,
AvatarFaviconSize,
} from './avatar-favicon.types';

const Favicon = (props: { src?: string; name: string }) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. Extracted into here + added image error handling to fallback to getAvatarFallbackLetter

@MetaMask MetaMask deleted a comment from metamaskbot Sep 13, 2025
@MetaMask MetaMask deleted a comment from metamaskbot Sep 13, 2025
@MetaMask MetaMask deleted a comment from metamaskbot Sep 13, 2025
@MetaMask MetaMask deleted a comment from metamaskbot Sep 13, 2025
@MetaMask MetaMask deleted a comment from metamaskbot Sep 13, 2025
@MetaMask MetaMask deleted a comment from metamaskbot Sep 13, 2025
@metamaskbot
Copy link
Collaborator

📊 Page Load Benchmark Results

Current Commit: 1701cfe | Date: 9/13/2025

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.04s (±75ms) 🟡 | historical mean value: 1.05s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 734ms (±87ms) 🟢 | historical mean value: 737ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 79ms (±43ms) 🟢 | historical mean value: 80ms ⬇️ (historical data)
📈 Detailed Results
Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.04s 75ms 1.01s 1.36s 1.31s 1.36s
domContentLoaded 734ms 87ms 695ms 1.30s 988ms 1.30s
firstPaint 79ms 43ms 60ms 508ms 84ms 508ms
firstContentfulPaint 79ms 43ms 60ms 508ms 84ms 508ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms

Results generated automatically by MetaMask CI

@metamaskbot
Copy link
Collaborator

Builds ready [1701cfe]
UI Startup Metrics (1236 ± 73 ms)
PlatformBuildTypePageMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P 75 (ms)P 95 (ms)
ChromeBrowserifyHomeuiStartup1236110414197312701381
load107396412567011111214
domContentLoaded106695812497011031204
domInteractive18144671742
firstPaint60385126443010721143
backgroundConnect2512382767254261
firstReactRender24185252534
getState1448991626
initialActions518410513
loadScripts822718100468858955
setupStore962631015
WebpackHomeuiStartup19321447257627621372443
load15571174196621317001877
domContentLoaded15491164194321216941864
domInteractive171286121447
firstPaint1636038563181317
backgroundConnect3016324312852
firstReactRender88363337178325
getState2742916413278
initialActions52234517
loadScripts15451161193121016911853
setupStore236302551228
FirefoxBrowserifyHomeuiStartup13731195163510414161625
load1185104914558212311325
domContentLoaded1185104914558212311324
domInteractive963322740107202
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect3419137193661
firstReactRender27224843036
getState8225625615
initialActions41587310
loadScripts1159103214358212111307
setupStore949210820
WebpackHomeuiStartup16631408225414817481928
load14221203171812615191663
domContentLoaded14211202171712715181663
domInteractive1123332061105309
firstPaintNaNNaNNaNNaNNaNNaN
backgroundConnect32226373745
firstReactRender47369374956
getState63202710
initialActions611682238
loadScripts13981183169212714961642
setupStore12520324919
Benchmark value 1237 exceeds gate value 1234 for chrome browserify home mean uiStartup
Benchmark value 1074 exceeds gate value 1070 for chrome browserify home mean load
Benchmark value 1067 exceeds gate value 1061 for chrome browserify home mean domContentLoaded
Benchmark value 251 exceeds gate value 10 for chrome browserify home mean backgroundConnect
Benchmark value 24 exceeds gate value 23 for chrome browserify home mean firstReactRender
Benchmark value 6 exceeds gate value 1 for chrome browserify home mean initialActions
Benchmark value 1381 exceeds gate value 1365 for chrome browserify home p95 uiStartup
Benchmark value 1214 exceeds gate value 1190 for chrome browserify home p95 load
Benchmark value 1205 exceeds gate value 1180 for chrome browserify home p95 domContentLoaded
Benchmark value 42 exceeds gate value 41 for chrome browserify home p95 domInteractive
Benchmark value 261 exceeds gate value 18 for chrome browserify home p95 backgroundConnect
Benchmark value 13 exceeds gate value 1.2 for chrome browserify home p95 initialActions
Benchmark value 955 exceeds gate value 940 for chrome browserify home p95 loadScripts
Benchmark value 278 exceeds gate value 195 for chrome webpack home p95 getState
Benchmark value 17 exceeds gate value 7 for chrome webpack home p95 initialActions
Benchmark value 35 exceeds gate value 25 for firefox browserify home mean backgroundConnect
Benchmark value 28 exceeds gate value 25 for firefox browserify home mean firstReactRender
Benchmark value 4 exceeds gate value 1 for firefox browserify home mean initialActions
Benchmark value 10 exceeds gate value 9 for firefox browserify home mean setupStore
Benchmark value 202 exceeds gate value 195 for firefox browserify home p95 domInteractive
Benchmark value 10 exceeds gate value 2 for firefox browserify home p95 initialActions
Benchmark value 1664 exceeds gate value 1615 for firefox webpack home mean uiStartup
Benchmark value 1422 exceeds gate value 1380 for firefox webpack home mean load
Benchmark value 1422 exceeds gate value 1380 for firefox webpack home mean domContentLoaded
Benchmark value 112 exceeds gate value 100 for firefox webpack home mean domInteractive
Benchmark value 32 exceeds gate value 26 for firefox webpack home mean backgroundConnect
Benchmark value 48 exceeds gate value 38 for firefox webpack home mean firstReactRender
Benchmark value 6 exceeds gate value 1 for firefox webpack home mean initialActions
Benchmark value 1399 exceeds gate value 1360 for firefox webpack home mean loadScripts
Benchmark value 1663 exceeds gate value 1660 for firefox webpack home p95 load
Benchmark value 1663 exceeds gate value 1660 for firefox webpack home p95 domContentLoaded
Benchmark value 309 exceeds gate value 156 for firefox webpack home p95 domInteractive
Benchmark value 56 exceeds gate value 50 for firefox webpack home p95 firstReactRender
Benchmark value 8 exceeds gate value 2 for firefox webpack home p95 initialActions
Benchmark value 1642 exceeds gate value 1630 for firefox webpack home p95 loadScripts
Sum of mean exceeds: 482ms | Sum of p95 exceeds: 626.8ms
Sum of all benchmark exceeds: 1108.8ms

Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 127.66 KiB (2.83%)
  • ui: -799.66 KiB (-10.23%)
  • common: 42.08 KiB (0.56%)

@n3ps n3ps requested a review from Montoya September 14, 2025 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Avatar fallback for connected dapp is incorrect when favicon URL returns an invalid response
2 participants