@@ -3,38 +3,15 @@ import { LoadedOnyxDocument, OnyxDocument } from "@/lib/search/interfaces";
3
3
import React , { memo } from "react" ;
4
4
import isEqual from "lodash/isEqual" ;
5
5
import { SourceIcon } from "@/components/SourceIcon" ;
6
- import { SearchResultIcon } from "@/components/SearchResultIcon" ;
7
6
import { WebResultIcon } from "@/components/WebResultIcon" ;
8
7
9
- const FALLBACK_ICON = "web.svg" ;
10
-
11
- // Updated error handler
12
- const handleError = (
13
- e : React . SyntheticEvent < HTMLImageElement > ,
14
- associatedDoc : OnyxDocument
15
- ) => {
16
- // Prevent future error events
17
- e . currentTarget . onerror = null ;
18
-
19
- // Repoint image source to fallback
20
- e . currentTarget . src = FALLBACK_ICON ;
21
-
22
- // If you prefer, log fewer times or log once.
23
- // For demonstration, we'll print a single warning:
24
- console . warn (
25
- `Failed to load favicon for document_id=${ associatedDoc ?. document_id } . Replacing with fallback icon.`
26
- ) ;
27
- } ;
28
-
29
8
export const MemoizedAnchor = memo (
30
9
( {
31
10
docs,
32
- iconMap,
33
11
updatePresentingDocument,
34
12
children,
35
13
} : {
36
14
docs ?: OnyxDocument [ ] | null ;
37
- iconMap ?: Record < string , string > ;
38
15
updatePresentingDocument : ( doc : OnyxDocument ) => void ;
39
16
children : React . ReactNode ;
40
17
} ) => {
@@ -48,26 +25,9 @@ export const MemoizedAnchor = memo(
48
25
return < > { children } </ > ;
49
26
}
50
27
51
- const effectiveIconURL =
52
- iconMap ?. [ associatedDoc . document_id ] || "globe.svg" ;
53
-
54
28
let icon : React . ReactNode = null ;
55
29
if ( associatedDoc . source_type === "web" ) {
56
30
icon = < WebResultIcon url = { associatedDoc . link } /> ;
57
- // (
58
- // <img
59
- // className="!m-0 !p-0 rounded-full"
60
- // height={18}
61
- // onError={(e) => {
62
- // handleError(e, associatedDoc);
63
- // }}
64
- // width={18}
65
- // src={`https://www.google.com/s2/favicons?domain=${
66
- // new URL(associatedDoc.link).hostname
67
- // }` }
68
- // alt="Favicon"
69
- // />
70
- // );
71
31
} else {
72
32
icon = (
73
33
< SourceIcon sourceType = { associatedDoc . source_type } iconSize = { 18 } />
0 commit comments