Skip to content

Commit

Permalink
Fix trait_type crasher
Browse files Browse the repository at this point in the history
  • Loading branch information
ChewingGlass committed Nov 10, 2023
1 parent 9a93c3e commit 5500cff
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/features/collectables/HotspotCompressedListItem.tsx
Original file line number Diff line number Diff line change
@@ -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(
2 changes: 1 addition & 1 deletion src/features/collectables/HotspotDetailsScreen.tsx
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 5500cff

Please sign in to comment.