Skip to content

Commit

Permalink
unify isSendingTx state
Browse files Browse the repository at this point in the history
  • Loading branch information
jonator committed May 31, 2024
1 parent 77167c6 commit a1cfe02
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/web/components/swap-tool/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,11 @@ export const SwapTool: FunctionComponent<SwapToolProps> = observer(
useWalletSelect();
const featureFlags = useFeatureFlags();
const [, setIs1CTIntroModalScreen] = useGlobalIs1CTIntroModalScreen();
const [isSendingTx, setIsSendingTx] = useState(false);

const account = accountStore.getWallet(chainId);

const [isSendingTx_, setIsSendingTx] = useState(false);
const isSendingTx = isSendingTx_ || Boolean(account?.txTypeInProgress);

const slippageConfig = useSlippageConfig();

const swapState = useSwap({
Expand Down Expand Up @@ -234,6 +236,7 @@ export const SwapTool: FunctionComponent<SwapToolProps> = observer(
});
};

/** Indicates any of the dependent queries in swap tool are loading. */
const isSwapToolLoading =
isWalletLoading ||
swapState.isQuoteLoading ||
Expand Down Expand Up @@ -977,7 +980,6 @@ export const SwapTool: FunctionComponent<SwapToolProps> = observer(
!Boolean(swapState.quote) ||
isSwapToolLoading ||
Boolean(swapState.error) ||
account?.txTypeInProgress !== "" ||
Boolean(swapState.networkFeeError)))
}
loadingText={buttonText}
Expand Down

0 comments on commit a1cfe02

Please sign in to comment.