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

fix: insufficient liquidity state flashes (#6733)

parent 310623b9
......@@ -36,9 +36,10 @@ export function useBestTrade(
const autoRouterSupported = useAutoRouterSupported()
const isWindowVisible = useIsWindowVisible()
const debouncedSwapQuoteFlagEnabled = useDebounceSwapQuoteFlag() === DebounceSwapQuoteVariant.Enabled
const [debouncedAmount, debouncedOtherCurrency] = useDebounce(
useMemo(() => [amountSpecified, otherCurrency], [amountSpecified, otherCurrency]),
useDebounceSwapQuoteFlag() === DebounceSwapQuoteVariant.Enabled ? DEBOUNCE_TIME_INCREASED : DEBOUNCE_TIME
debouncedSwapQuoteFlagEnabled ? DEBOUNCE_TIME_INCREASED : DEBOUNCE_TIME
)
const isAWrapTransaction = useMemo(() => {
......@@ -60,7 +61,9 @@ export function useBestTrade(
routerPreference
)
const isLoading = routingAPITrade.state === TradeState.LOADING
const inDebounce =
(!debouncedAmount && Boolean(amountSpecified)) || (!debouncedOtherCurrency && Boolean(otherCurrency))
const isLoading = routingAPITrade.state === TradeState.LOADING || inDebounce
const useFallback = (!autoRouterSupported || routingAPITrade.state === TradeState.NO_ROUTE_FOUND) && shouldGetTrade
// only use client side router if routing api trade failed or is not supported
......
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