interface now laod faster
This commit is contained in:
+14
-1
@@ -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]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user