Skip to content

Commit

Permalink
📝 moved useEffect
Browse files Browse the repository at this point in the history
  • Loading branch information
MattPoblete committed Sep 6, 2024
1 parent 935b421 commit df76054
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/components/Swap/SwapComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,14 @@ export function SwapComponent({
inputError: swapInputError,
} = useDerivedSwapInfo(state);

useEffect(() => {
if (typeof currencyBalances[Field.OUTPUT] != 'string' && currencyBalances[Field.OUTPUT].balance === undefined) {
setNeedTrustline(true);
} else {
setNeedTrustline(false);
}
}, [sorobanContext, currencies, currencyBalances, trade]);

const parsedAmounts = useMemo(
() => ({
[Field.INPUT]: independentField === Field.INPUT ? parsedAmount : trade?.inputAmount,
Expand Down Expand Up @@ -341,14 +349,6 @@ export function SwapComponent({

const nativeBalance = useGetNativeTokenBalance();

useEffect(() => {
if (typeof currencyBalances[Field.OUTPUT] != 'string' && currencyBalances[Field.OUTPUT].balance === undefined) {
setNeedTrustline(true);
} else {
setNeedTrustline(false);
}
}, [sorobanContext, currencies, currencyBalances, trade]);

const { networkFees, isLoading: isLoadingNetworkFees } = useSwapNetworkFees(trade, currencies);

const { getMainButtonText, isMainButtonDisabled, handleMainButtonClick, getSwapValues } =
Expand Down

0 comments on commit df76054

Please sign in to comment.