Commit cc325b2f authored by eddie's avatar eddie Committed by GitHub

fix: no stale trade when otherCurrency is missing (#7403)

parent 2694379c
......@@ -96,6 +96,7 @@ export function useDebouncedTrade(
const skipBothFetches = !autoRouterSupported || !isWindowVisible || isWrap
const skipRoutingFetch = skipBothFetches || isDebouncing
const skipPreviewTradeFetch =
skipBothFetches || routerPreference === RouterPreference.CLIENT || isPreviewTradeDebouncing
......
......@@ -88,7 +88,7 @@ export function usePreviewTrade(
const isFetching = currentData !== tradeResult || !currentData
return useMemo(() => {
if (amountSpecified && queryArgs === skipToken) {
if (amountSpecified && otherCurrency && queryArgs === skipToken) {
return {
state: TradeState.STALE,
trade: tradeResult?.trade,
......@@ -124,5 +124,6 @@ export function usePreviewTrade(
tradeResult?.state,
tradeResult?.trade,
currentData?.trade,
otherCurrency,
])
}
......@@ -104,7 +104,7 @@ export function useRoutingAPITrade<TTradeType extends TradeType>(
const isFetching = currentData !== tradeResult || !currentData
return useMemo(() => {
if (amountSpecified && queryArgs === skipToken) {
if (amountSpecified && otherCurrency && queryArgs === skipToken) {
return {
state: TradeState.STALE,
trade: tradeResult?.trade,
......@@ -140,5 +140,6 @@ export function useRoutingAPITrade<TTradeType extends TradeType>(
tradeResult?.state,
tradeResult?.trade,
currentData?.trade,
otherCurrency,
])
}
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