Skip to content

Commit

Permalink
fix: Service alerts would loop twice
Browse files Browse the repository at this point in the history
  • Loading branch information
wd7bxscience committed May 15, 2024
1 parent bde55c8 commit a1d17a4
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default function Home() {
setStatus(true);
console.log("Message recieved.");

const message = JSON.parse(event.data);
const message: Import = JSON.parse(event.data);
setImportConfig(message);

const headers: Array<string> = [];
Expand Down Expand Up @@ -75,20 +75,6 @@ export default function Home() {
};
});

useEffect(() => {
const loop = setInterval(() => {
if (serviceAlerts.length == 0) {
setIndex(0);
return;
}
setIndex((i) => (((i + 1) % serviceAlerts.length) + serviceAlerts.length) % serviceAlerts.length);
}, 5000);

return () => {
clearInterval(loop);
};
}, [serviceAlerts.length]);

useEffect(() => {
const loop = setInterval(() => {
const date = new Date();
Expand Down

0 comments on commit a1d17a4

Please sign in to comment.