fix(gui): Fetch alerts only once

This commit is contained in:
Binarybaron 2025-05-15 18:26:23 +02:00
parent 23abb13315
commit 8ec58dcb1e
2 changed files with 9 additions and 1 deletions

View file

@ -162,7 +162,12 @@ export async function updatePublicRegistry(): Promise<void> {
store.dispatch(registryConnectionFailed());
logger.error(error, "Error fetching providers");
}
}
/**
* Fetch all alerts
*/
export async function updateAlerts(): Promise<void> {
try {
const alerts = await fetchAlertsViaHttp();
store.dispatch(setAlerts(alerts));

View file

@ -3,7 +3,7 @@ import { TauriSwapProgressEventWrapper, TauriContextStatusEvent, TauriLogEvent,
import { contextStatusEventReceived, receivedCliLog, rpcSetBalance, timelockChangeEventReceived, rpcSetBackgroundRefundState, approvalEventReceived } from "store/features/rpcSlice";
import { swapProgressEventReceived } from "store/features/swapSlice";
import logger from "utils/logger";
import { fetchAllConversations, updatePublicRegistry, updateRates } from "./api";
import { fetchAllConversations, updateAlerts, updatePublicRegistry, updateRates } from "./api";
import { checkContextAvailability, getSwapInfo, initializeContext, updateAllNodeStatuses } from "./rpc";
import { store } from "./store/storeRenderer";
@ -31,6 +31,9 @@ export async function setupBackgroundTasks(): Promise<void> {
setIntervalImmediate(updateRates, UPDATE_RATE_INTERVAL);
setIntervalImmediate(fetchAllConversations, FETCH_CONVERSATIONS_INTERVAL);
// Fetch all alerts
updateAlerts();
// // Setup Tauri event listeners
// Check if the context is already available. This is to prevent unnecessary re-initialization