Skip to content

Commit

Permalink
fix empty details block
Browse files Browse the repository at this point in the history
  • Loading branch information
sviderock committed Dec 16, 2024
1 parent 7cdaac1 commit b47fc77
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/earn/EarnEnterAmount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export default function EarnEnterAmount({ route }: Props) {
)
}, FETCH_UPDATED_TRANSACTIONS_DEBOUNCE_TIME_MS)
return () => clearTimeout(debouncedRefreshTransactions)
}, [processedAmounts.token.bignum?.toString(), mode, transactionToken, feeCurrencies])
}, [processedAmounts.token.bignum?.toString(), mode, transactionToken, inputToken, feeCurrencies])

const { estimatedFeeAmount, feeCurrency, maxFeeAmount } =
getFeeCurrencyAndAmounts(prepareTransactionsResult)
Expand Down Expand Up @@ -370,7 +370,7 @@ export default function EarnEnterAmount({ route }: Props) {
swapTransaction={swapTransaction}
/>
)}
{isWithdrawal && (
{!!processedAmounts.token.bignum && isWithdrawal && (
<TransactionWithdrawDetails
pool={pool}
token={transactionToken}
Expand Down Expand Up @@ -527,6 +527,15 @@ function TransactionWithdrawDetails({
const { t } = useTranslation()
const { maxFeeAmount, feeCurrency } = getFeeCurrencyAndAmounts(prepareTransactionsResult)

/**
* This details block renders only conditional sections. If no checks pass - the empty box will
* be shown (and we don't want that). In order to omit the empty box - we don't render anything
* if all the variables necessary for at least one successful condition is false.
*/
if (!maxFeeAmount && !feeCurrency && !pool.dataProps.withdrawalIncludesClaim) {
return null
}

return (
<View style={styles.txDetailsContainer} testID="EnterAmountWithdrawInfoCard">
{pool.dataProps.withdrawalIncludesClaim &&
Expand Down

0 comments on commit b47fc77

Please sign in to comment.