-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bugfix/countdown timer refresh swap form (#6178)
* fix(LIVE-11267): regression on analytics refreshing every 1 sec * fix(LIVE-11267): add changeset * Revert "[fix/LIVE-11122]: update quotes when timeout reaches 0 in swap. (#6118)" This reverts commit 63099cc. * fix(LIVE-11267): remove useless files
- Loading branch information
1 parent
328573a
commit ff54d02
Showing
14 changed files
with
104 additions
and
72 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"ledger-live-desktop": patch | ||
--- | ||
|
||
Revert counter and refresh rate changes and fix moonpay not refreshing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 25 additions & 6 deletions
31
apps/ledger-live-desktop/src/renderer/screens/exchange/Swap2/Form/Rates/Countdown.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
apps/ledger-live-desktop/src/renderer/screens/exchange/Swap2/Form/hooks/useRefreshRates.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { useRef, useEffect } from "react"; | ||
import { SwapDataType } from "@ledgerhq/live-common/exchange/swap/types"; | ||
import { DEFAULT_SWAP_RATES_INTERVAL_MS } from "@ledgerhq/live-common/exchange/swap/const/timeout"; | ||
|
||
const useRefreshRates = ( | ||
swap: SwapDataType, | ||
{ | ||
pause, | ||
}: { | ||
pause: boolean; | ||
}, | ||
) => { | ||
const refreshInterval = useRef<NodeJS.Timeout>(); | ||
const refreshTime = DEFAULT_SWAP_RATES_INTERVAL_MS; | ||
|
||
useEffect(() => { | ||
clearTimeout(refreshInterval.current); | ||
refreshInterval.current = setTimeout(() => { | ||
if (!pause) { | ||
swap.refetchRates(); | ||
} | ||
}, refreshTime); | ||
return () => { | ||
clearTimeout(refreshInterval.current); | ||
}; | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, [pause, refreshTime, swap.rates?.value]); | ||
|
||
return refreshTime; | ||
}; | ||
|
||
export default useRefreshRates; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.