Skip to content

Commit 8c4bfcb

Browse files
committed
Revert "fix(favicon): record an icon that failed before hydration"
The failure it recorded was never the cause: Links read its favicons twice because the server rows were discarded before they hydrated, so no ref on them ever ran. Links, its one server-rendered caller, holds the globe either way, and every other caller mounts after hydration. This reverts commit 0a4901f.
1 parent e308b6d commit 8c4bfcb

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

‎apps/sim/components/favicon.tsx‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,25 +32,21 @@ interface FaviconProps {
3232
export function Favicon({ host, fallback, className, onLoad }: FaviconProps) {
3333
const [, rerender] = useReducer((failures: number) => failures + 1, 0)
3434
if (!host || knownMisses.has(host)) return fallback
35-
const recordMiss = () => {
36-
knownMisses.set(host, true)
37-
rerender()
38-
}
3935
return (
4036
<img
4137
ref={(image) => {
42-
if (!image?.complete) return
43-
if (image.naturalWidth > 0) onLoad?.()
44-
// A failure before hydration fires no onError, and a remount would ask for the icon again.
45-
else void image.decode().catch(recordMiss)
38+
if (onLoad && image?.complete && image.naturalWidth > 0) onLoad()
4639
}}
4740
src={faviconSrc(host)}
4841
alt=''
4942
loading='lazy'
5043
decoding='async'
5144
className={cn('rounded-sm', className)}
5245
onLoad={onLoad}
53-
onError={recordMiss}
46+
onError={() => {
47+
knownMisses.set(host, true)
48+
rerender()
49+
}}
5450
/>
5551
)
5652
}

0 commit comments

Comments
 (0)