Skip to content

Commit 8925bc8

Browse files
committed
fix(gui): Fetch alerts only once
1 parent 7873a45 commit 8925bc8

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src-gui/src/renderer/api.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,12 @@ export async function updatePublicRegistry(): Promise<void> {
162162
store.dispatch(registryConnectionFailed());
163163
logger.error(error, "Error fetching providers");
164164
}
165+
}
165166

167+
/**
168+
* Fetch all alerts
169+
*/
170+
export async function updateAlerts(): Promise<void> {
166171
try {
167172
const alerts = await fetchAlertsViaHttp();
168173
store.dispatch(setAlerts(alerts));

src-gui/src/renderer/background.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { TauriSwapProgressEventWrapper, TauriContextStatusEvent, TauriLogEvent,
33
import { contextStatusEventReceived, receivedCliLog, rpcSetBalance, timelockChangeEventReceived, rpcSetBackgroundRefundState, approvalEventReceived } from "store/features/rpcSlice";
44
import { swapProgressEventReceived } from "store/features/swapSlice";
55
import logger from "utils/logger";
6-
import { fetchAllConversations, updatePublicRegistry, updateRates } from "./api";
6+
import { fetchAllConversations, updateAlerts, updatePublicRegistry, updateRates } from "./api";
77
import { checkContextAvailability, getSwapInfo, initializeContext, updateAllNodeStatuses } from "./rpc";
88
import { store } from "./store/storeRenderer";
99

@@ -31,6 +31,9 @@ export async function setupBackgroundTasks(): Promise<void> {
3131
setIntervalImmediate(updateRates, UPDATE_RATE_INTERVAL);
3232
setIntervalImmediate(fetchAllConversations, FETCH_CONVERSATIONS_INTERVAL);
3333

34+
// Fetch all alerts
35+
updateAlerts();
36+
3437
// // Setup Tauri event listeners
3538

3639
// Check if the context is already available. This is to prevent unnecessary re-initialization

0 commit comments

Comments
 (0)