From 723c9e89b01147041676c8ac22ec499c1882df10 Mon Sep 17 00:00:00 2001 From: Alex Blank Date: Fri, 7 Feb 2025 15:26:59 +0100 Subject: [PATCH] interface now laod faster --- src/app/page.tsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/app/page.tsx b/src/app/page.tsx index 8b3c2fc..6df6911 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -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]);