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(() => {