From 038d7b7d77dfab18a8dbed55f365a9971ad5e1f0 Mon Sep 17 00:00:00 2001 From: gregs Date: Sat, 29 Jun 2024 18:04:22 -0300 Subject: [PATCH] placeholderData --- .../screens/Swap/hooks/useSwapEstimatedGasLimit.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/__swaps__/screens/Swap/hooks/useSwapEstimatedGasLimit.ts b/src/__swaps__/screens/Swap/hooks/useSwapEstimatedGasLimit.ts index 564c8286d60..9149ee472bb 100644 --- a/src/__swaps__/screens/Swap/hooks/useSwapEstimatedGasLimit.ts +++ b/src/__swaps__/screens/Swap/hooks/useSwapEstimatedGasLimit.ts @@ -71,7 +71,7 @@ export function useSwapEstimatedGasLimit( { chainId, quote, assetToSell }: EstimateSwapGasLimitArgs, config: QueryConfigWithSelect = {} ) { - const initialData = chainId && { chainId, gasLimit: gasUnits.basic_swap[chainId] }; + const placeholderData = chainId && { chainId, gasLimit: gasUnits.basic_swap[chainId] }; const { data, isFetching } = useQuery( estimateSwapGasLimitQueryKey({ chainId, @@ -85,8 +85,7 @@ export function useSwapEstimatedGasLimit( notifyOnChangeProps: ['data', 'isFetching'], keepPreviousData: true, enabled: !!chainId && !!quote && !!assetToSell && assetToSell.chainId === chainId, - initialData, - initialDataUpdatedAt: 0, + placeholderData, ...config, } ); @@ -95,7 +94,7 @@ export function useSwapEstimatedGasLimit( // which is great when refetching for the same chainId, but we don't want to keep the previous data // when fetching for a different chainId return { - data: data && data.chainId === chainId ? data.gasLimit : initialData?.gasLimit, + data: data && data.chainId === chainId ? data.gasLimit : placeholderData?.gasLimit, isFetching, }; }