Commit f290787b authored by Jack Short's avatar Jack Short Committed by GitHub

fix: divide by zero error on pool page (#6837)

* fix: divide by zero error on pool page

* removing changes here

* adding price in conditional

---------
Co-authored-by: default avatarJohn Short <john.short@CORN-Jack-899.local>
parent 2f84507a
......@@ -21,6 +21,11 @@ export function PoolPriceBar({
price?: Price<Currency, Currency>
}) {
const theme = useTheme()
const canInvertPrice = Boolean(
price && price.baseCurrency && price.quoteCurrency && !price.baseCurrency.equals(price.quoteCurrency)
)
const invertedPrice = canInvertPrice ? price?.invert()?.toSignificant(6) : undefined
return (
<AutoColumn gap="md">
<AutoRow justify="space-around" gap="4px">
......@@ -33,7 +38,7 @@ export function PoolPriceBar({
</Text>
</AutoColumn>
<AutoColumn justify="center">
<ThemedText.DeprecatedBlack>{price?.invert()?.toSignificant(6) ?? '-'}</ThemedText.DeprecatedBlack>
<ThemedText.DeprecatedBlack>{invertedPrice ?? '-'}</ThemedText.DeprecatedBlack>
<Text fontWeight={500} fontSize={14} color={theme.textSecondary} pt={1}>
<Trans>
{currencies[Field.CURRENCY_A]?.symbol} per {currencies[Field.CURRENCY_B]?.symbol}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment