mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-12-17 17:44:02 -05:00
refactor(gui): seperate get info and get timelock to speed up display of swaps (#661)
* refactor(gui): seperate get info and get timelock to speed up display of swaps * progress * progress * remove unused function useSwapInfoWithTimelock * use GetSwapTimelockArgs and GetSwapTimelockResponse types
This commit is contained in:
parent
0fec5d556d
commit
33662b0a06
11 changed files with 333 additions and 203 deletions
|
|
@ -21,6 +21,7 @@ import {
|
|||
import {
|
||||
checkContextStatus,
|
||||
getSwapInfo,
|
||||
getSwapTimelock,
|
||||
initializeContext,
|
||||
listSellersAtRendezvousPoint,
|
||||
refreshApprovals,
|
||||
|
|
@ -122,12 +123,32 @@ listen<TauriEvent>(TAURI_UNIFIED_EVENT_CHANNEL_NAME, (event) => {
|
|||
break;
|
||||
|
||||
case "SwapDatabaseStateUpdate":
|
||||
getSwapInfo(eventData.swap_id);
|
||||
getSwapInfo(eventData.swap_id).catch((error) => {
|
||||
logger.debug(
|
||||
`Failed to fetch swap info for swap ${eventData.swap_id}: ${error}`,
|
||||
);
|
||||
});
|
||||
getSwapTimelock(eventData.swap_id).catch((error) => {
|
||||
logger.debug(
|
||||
`Failed to fetch timelock for swap ${eventData.swap_id}: ${error}`,
|
||||
);
|
||||
});
|
||||
|
||||
// This is ugly but it's the best we can do for now
|
||||
// Sometimes we are too quick to fetch the swap info and the new state is not yet reflected
|
||||
// in the database. So we wait a bit before fetching the new state
|
||||
setTimeout(() => getSwapInfo(eventData.swap_id), 3000);
|
||||
setTimeout(() => {
|
||||
getSwapInfo(eventData.swap_id).catch((error) => {
|
||||
logger.debug(
|
||||
`Failed to fetch swap info for swap ${eventData.swap_id}: ${error}`,
|
||||
);
|
||||
});
|
||||
getSwapTimelock(eventData.swap_id).catch((error) => {
|
||||
logger.debug(
|
||||
`Failed to fetch timelock for swap ${eventData.swap_id}: ${error}`,
|
||||
);
|
||||
});
|
||||
}, 3000);
|
||||
break;
|
||||
|
||||
case "TimelockChange":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue