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