Skip to content

Commit

Permalink
fix: refresh bug fix (#6277)
Browse files Browse the repository at this point in the history
  • Loading branch information
ezailWang authored Nov 27, 2024
1 parent 54ff092 commit 21126f1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/kit/src/views/Swap/components/SwapRefreshButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const SwapRefreshButton = ({
}) => {
const loadingAnim = useRef(new Animated.Value(0)).current;
const processAnim = useRef(new Animated.Value(0)).current;
const processAnimRef = useRef<Animated.CompositeAnimation>();
const themeVariant = useThemeVariant();
const lottieRef = useRef<any>(null);
const isFocused = useRouteIsFocused();
Expand Down Expand Up @@ -52,14 +53,17 @@ const SwapRefreshButton = ({

useEffect(() => {
if (!isRefreshQuoteRef.current) {
Animated.timing(processAnim, {
processAnimRef.current = Animated.timing(processAnim, {
toValue: swapRefreshInterval,
duration: swapRefreshInterval,
useNativeDriver: true,
}).start();
});
processAnimRef.current?.reset();
processAnimRef.current?.start();
} else {
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call
lottieRef.current?.reset();
processAnimRef.current?.reset();
}
}, [processAnim, isRefreshQuote]);

Expand Down
1 change: 1 addition & 0 deletions packages/kit/src/views/Swap/hooks/useSwapQuote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export function useSwapQuote() {
const swapShouldRefreshRef = useRef(swapShouldRefresh);
const swapQuoteActionLockRef = useRef(swapQuoteActionLock);
const swapQuoteFetchingRef = useRef(swapQuoteFetching);

const swapSlippageRef = useRef(slippageItem);
if (swapQuoteFetchingRef.current !== swapQuoteFetching) {
swapQuoteFetchingRef.current = swapQuoteFetching;
Expand Down

0 comments on commit 21126f1

Please sign in to comment.