Skip to content

Commit

Permalink
fix(unlock-app): handling missing symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
julien51 committed Jun 20, 2024
1 parent e667a14 commit 61ab6f4
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions unlock-app/src/components/interface/checkout/main/Payment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ export function Payment({ checkoutService }: Props) {
</div>
<div className="flex items-center justify-between w-full">
<div className="flex items-center w-full text-sm text-left text-gray-500">
Your balance of {symbol.toUpperCase()} on{' '}
Your balance of {symbol?.toUpperCase()} on{' '}
{networkConfig.name}:{' ~'}
{formatNumber(Number(balance?.balance))}{' '}
</div>
Expand Down Expand Up @@ -349,7 +349,13 @@ export function Payment({ checkoutService }: Props) {
crossChainRoutes?.map((route, index) => {
const symbol = route.tokenPayment.isNative
? route.currency
: route.tokenPayment.symbol
: route.tokenPayment.symbol || ''

if (!symbol) {
// Some routes are returned with Decent without a token
console.error('Missing symbol for route', route)
return null
}
return (
<button
key={index}
Expand Down Expand Up @@ -383,7 +389,7 @@ export function Payment({ checkoutService }: Props) {
</div>
<div className="flex items-center justify-between w-full">
<div className="w-full text-sm text-left text-gray-500">
Your balance of {symbol.toUpperCase()} on{' '}
Your balance of {symbol?.toUpperCase()} on{' '}
{route.networkName}:{' ~'}
{formatNumber(Number(route.userTokenBalance))}. Payment
through
Expand Down

0 comments on commit 61ab6f4

Please sign in to comment.