@@ -3,12 +3,12 @@ import { memo, useCallback, useEffect, useState } from "react";
33import { EthereumIcon } from "./EthereumIcon" ;
44
55const getInitials = ( symbol : string ) => {
6- return symbol . slice ( 0 , 2 ) . toUpperCase ( ) ;
6+ return symbol ? .slice ( 0 , 2 ) . toUpperCase ( ) ?? "" ;
77} ;
88
99// Color map for token initials - matching your screenshot
1010const getColorForSymbol = ( symbol : string ) => {
11- const symbolKey = symbol . toLowerCase ( ) ;
11+ const symbolKey = symbol ? .toLowerCase ( ) ?? "" ;
1212 const colorMap : Record < string , { bg : string ; text : string } > = {
1313 eth : { bg : "bg-black" , text : "text-white" } ,
1414 za : { bg : "bg-red-500" , text : "text-white" } ,
@@ -186,7 +186,9 @@ export const TokenImage = memo(
186186 if ( cached === "true" ) {
187187 // We know this token has no URI, use the optimized render path
188188 return (
189- < div className = { `w-8 h-8 flex ${ bg } ${ text } justify-center items-center rounded-full text-xs font-medium` } >
189+ < div
190+ className = { `w-8 h-8 flex ${ bg } ${ text } justify-center items-center rounded-full text-xs font-medium` }
191+ >
190192 { getInitials ( token . symbol ) }
191193 </ div >
192194 ) ;
@@ -198,7 +200,9 @@ export const TokenImage = memo(
198200 }
199201
200202 return (
201- < div className = { `w-8 h-8 flex ${ bg } ${ text } justify-center items-center rounded-full text-xs font-medium` } >
203+ < div
204+ className = { `w-8 h-8 flex ${ bg } ${ text } justify-center items-center rounded-full text-xs font-medium` }
205+ >
202206 { getInitials ( token . symbol ) }
203207 </ div >
204208 ) ;
@@ -208,7 +212,9 @@ export const TokenImage = memo(
208212 if ( ! actualImageUrl && ! imageError ) {
209213 return (
210214 < div className = "relative w-8 h-8 rounded-full overflow-hidden" >
211- < div className = { `w-8 h-8 flex ${ bg } ${ text } justify-center items-center rounded-full` } >
215+ < div
216+ className = { `w-8 h-8 flex ${ bg } ${ text } justify-center items-center rounded-full` }
217+ >
212218 { getInitials ( token . symbol ) }
213219 </ div >
214220 </ div >
@@ -243,6 +249,9 @@ export const TokenImage = memo(
243249 } ,
244250 ( prevProps , nextProps ) => {
245251 // Only re-render if token ID or URI changes
246- return prevProps . token . id === nextProps . token . id && prevProps . token . tokenUri === nextProps . token . tokenUri ;
252+ return (
253+ prevProps . token . id === nextProps . token . id &&
254+ prevProps . token . tokenUri === nextProps . token . tokenUri
255+ ) ;
247256 } ,
248257) ;
0 commit comments