From f193f87842e0f4fd1f4e188ab42acc04e91ed6f9 Mon Sep 17 00:00:00 2001 From: David Wang Date: Tue, 16 Apr 2024 23:00:49 -0400 Subject: [PATCH] fix: What if I used 100% of my brain? --- app/components/Alert.tsx | 2 +- app/page.tsx | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/components/Alert.tsx b/app/components/Alert.tsx index e5c8370..ea51ffd 100644 --- a/app/components/Alert.tsx +++ b/app/components/Alert.tsx @@ -18,7 +18,7 @@ export function Alert(props: { return (
- {headers.length > 0 ? ( + {headers.length > 1 ? ( ) : ( diff --git a/app/page.tsx b/app/page.tsx index 228f7e1..5ad1e8b 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -69,10 +69,10 @@ export default function Home() { }); setServiceAlerts(delayData); - if (serviceAlerts.length === 0) { - setIndex(0); + if (serviceData.length > 0) { + setIndex((i) => ((i % serviceData.length) + serviceData.length) % serviceData.length); } else { - setIndex((i) => ((i % serviceAlerts.length) + serviceAlerts.length) % serviceAlerts.length); + setIndex(0); } const routeData: { [key: string]: { [key: string]: string } } = message["routes"]; @@ -97,7 +97,7 @@ export default function Home() { console.log("Websocket closing."); ws.close(); }; - }, [serviceAlerts.length]); + }, []); useEffect(() => { const loop = setInterval(() => {