interface now laod faster

This commit is contained in:
2025-02-07 15:26:59 +01:00
parent f9a4e7f7fa
commit 723c9e89b0
+14 -1
View File
@@ -47,7 +47,8 @@ const Page = () => {
// periodically check if the websocket connection is still alive
useEffect(() => {
const interval = setInterval(() => {
function connectionChecker() {
// wait for appConfig to be fetched
if (!appConfig) {
console.log("AppConfig not fetched yet");
@@ -75,7 +76,19 @@ const Page = () => {
});
}
}
// run once on startup
setTimeout(() => {
connectionChecker();
}, 10);
// run every 2 seconds
const interval = setInterval(() => {
connectionChecker();
}, 2000);
return () => clearInterval(interval);
}, [appConfig]);