fix score feed getting stuck
All checks were successful
Deploy Website / deploy (push) Successful in 8m21s

This commit is contained in:
Lee 2024-10-13 05:14:03 +01:00
parent aa4ef05b55
commit 4d27fe9bae

@ -22,13 +22,9 @@ export default function ScoreFeed() {
} }
setScores(prev => { setScores(prev => {
const newScores = [...prev, commandData]; return [...prev, commandData]
if (newScores.length > 8) { .sort((a, b) => parseDate(b.score.timeSet).getTime() - parseDate(a.score.timeSet).getTime())
newScores.pop(); .slice(0, 8);
}
// Newest to oldest
return newScores.sort((a, b) => parseDate(b.score.timeSet).getTime() - parseDate(a.score.timeSet).getTime());
}); });
}, [lastJsonMessage]); }, [lastJsonMessage]);