7b06158e69ce
restore favicon for visited sites, globe still falls back to initials chip
- time
- 2026-05-21 15:27 UTC · 5 months ago
- machine
- koh2
- parent
- dbe895fe63e4
↓ peach-browser-7b06158e.tar.gzatlas at this save
files changed1 file
src/popup/views/Vault.tsx+28 −3src/popup/views/Vault.tsx+28 −3
@@ -1,6 +1,7 @@11 import { createEffect, createMemo, createSignal, For, Show } from "solid-js";22 import type { VaultEntry } from "../../shared/types";33 import { extractDomain, getDisplayDomain } from "../../shared/domain";4+import { faviconUrl } from "../../shared/favicon";45 import { popupCopy } from "../copy";56 67 function vibrate(ms: number) {@@ -8,9 +9,33 @@89 }910 1011 function FaviconIcon(props: { domain: string; title?: string; isNote: boolean; isPasskey: boolean }) {11- if (props.isPasskey) return <PasskeyIcon />;12- if (props.isNote) return <NoteIcon />;13- return <InitialsChip title={props.title ?? props.domain ?? ""} />;12+ const src = props.domain && !props.isNote && !props.isPasskey13+ ? faviconUrl(props.domain)14+ : null;15+ const fallback = props.isPasskey16+ ? <PasskeyIcon />17+ : props.isNote18+ ? <NoteIcon />19+ : <InitialsChip title={props.title ?? props.domain ?? ""} />;20+ const [failed, setFailed] = createSignal(false);21+ return (22+ <Show when={src && !failed()} fallback={fallback}>23+ <img24+ src={src!}25+ width="16"26+ height="16"27+ alt=""28+ style="border-radius:3px;"29+ onError={() => setFailed(true)}30+ onLoad={(e) => {31+ // Chrome's _favicon/ returns the default globe at its native 16×1632+ // even when size=32 is requested. A genuinely cached favicon arrives33+ // at ≥32px. Treat ≤16 as "no favicon" so InitialsChip shows instead.34+ if ((e.currentTarget as HTMLImageElement).naturalWidth <= 16) setFailed(true);35+ }}36+ />37+ </Show>38+ );1439 }1540 1641 /**