From 5500cff8ce2028099edbe1ec1557ceed8a71df1e Mon Sep 17 00:00:00 2001 From: Chewing Glass Date: Fri, 10 Nov 2023 13:29:18 -0600 Subject: [PATCH] Fix trait_type crasher --- src/features/collectables/HotspotCompressedListItem.tsx | 7 ++++--- src/features/collectables/HotspotDetailsScreen.tsx | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/features/collectables/HotspotCompressedListItem.tsx b/src/features/collectables/HotspotCompressedListItem.tsx index bf91d103a..a7afa454b 100644 --- a/src/features/collectables/HotspotCompressedListItem.tsx +++ b/src/features/collectables/HotspotCompressedListItem.tsx @@ -30,7 +30,7 @@ const HotspotListItem = ({ ...rest }: HotspotListItemProps) => { const { - content: { metadata }, + content: { metadata, json_uri }, } = hotspot const streetAddress = useHotspotAddress(hotspot) @@ -72,8 +72,9 @@ const HotspotListItem = ({ return undefined } - return metadata.attributes.find((attr) => attr.trait_type === 'ecc_compact') - ?.value + return metadata.attributes.find( + (attr) => attr?.trait_type === 'ecc_compact', + )?.value }, [metadata]) const hasIotRewards = useMemo( diff --git a/src/features/collectables/HotspotDetailsScreen.tsx b/src/features/collectables/HotspotDetailsScreen.tsx index 16cfb3e02..64ff04e3b 100644 --- a/src/features/collectables/HotspotDetailsScreen.tsx +++ b/src/features/collectables/HotspotDetailsScreen.tsx @@ -186,7 +186,7 @@ const HotspotDetailsScreen = () => { if (!collectable?.content?.metadata) return const attribute = collectable?.content?.metadata.attributes?.find( - (a) => a.trait_type === 'ecc_compact', + (a) => a?.trait_type === 'ecc_compact', ) if (!attribute?.value) return