Skip to content

Commit

Permalink
fix: loading state post-error (Uniswap#516)
Browse files Browse the repository at this point in the history
  • Loading branch information
just-toby authored Feb 28, 2023
1 parent 24fcb89 commit 677430b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/hooks/routing/useRouterTrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ export function useRouterTrade(
}
}, [amountSpecified, quoteConfig])

// Get the cached state *immediately* to update the UI without sending a request - using useGetQuoteQueryState -
// but debounce the actual request - using useLazyGetQuoteQuery - to avoid flooding the router / JSON-RPC endpoints.
// Get the cached state *immediately* to update the UI without sending a request - using useGetTradeQuoteQueryState -
// but debounce the actual request - using useLazyGetTradeQuoteQuery - to avoid flooding the router / JSON-RPC endpoints.
const { isError, data, currentData, fulfilledTimeStamp } = useGetTradeQuoteQueryState(queryArgs)

// An already-fetched value should be refetched if it is older than the pollingInterval.
Expand All @@ -82,7 +82,7 @@ export function useRouterTrade(
return useMemo(() => {
if (!amountSpecified || isError || queryArgs === skipToken) {
return TRADE_INVALID
} else if (data === NO_ROUTE) {
} else if (data === NO_ROUTE && isValid) {
return TRADE_NOT_FOUND
} else if (!tradeResult?.trade) {
return TRADE_LOADING
Expand Down

0 comments on commit 677430b

Please sign in to comment.