Skip to content

Commit

Permalink
fix: hide toolbar when insufficient liquidity (Uniswap#558)
Browse files Browse the repository at this point in the history
* fix: hide toolbar when insufficient liquidity

* fix: remove ternary
  • Loading branch information
just-toby committed Mar 14, 2023
1 parent 771e41f commit e3c9a20
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/Swap/Toolbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,12 @@ function CaptionRow() {
}
}

if (state === TradeState.INVALID || state === TradeState.NO_ROUTE_FOUND) {
if (state === TradeState.INVALID) {
return { caption: <Caption.Error /> }
}
if (state === TradeState.NO_ROUTE_FOUND) {
return { caption: null }
}
}

return { caption: <Caption.MissingInputs /> }
Expand Down Expand Up @@ -146,7 +149,7 @@ function CaptionRow() {
return rows
}, [gasUseEstimateUSD, impact, slippage, trade])

if (inputCurrency == null || outputCurrency == null || error === ChainError.MISMATCHED_CHAINS) {
if (inputCurrency == null || outputCurrency == null || error === ChainError.MISMATCHED_CHAINS || caption === null) {
return null
}
return (
Expand Down

0 comments on commit e3c9a20

Please sign in to comment.