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
|
// periodically check if the websocket connection is still alive
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const interval = setInterval(() => {
|
|
||||||
|
function connectionChecker() {
|
||||||
// wait for appConfig to be fetched
|
// wait for appConfig to be fetched
|
||||||
if (!appConfig) {
|
if (!appConfig) {
|
||||||
console.log("AppConfig not fetched yet");
|
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);
|
}, 2000);
|
||||||
|
|
||||||
|
|
||||||
return () => clearInterval(interval);
|
return () => clearInterval(interval);
|
||||||
}, [appConfig]);
|
}, [appConfig]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user