fix: no stale trade when otherCurrency is missing (#7403)
This commit is contained in:
parent
2694379c97
commit
cc325b2fbe
@ -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,
|
||||
])
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user