fix score feed getting stuck
All checks were successful
Deploy Website / deploy (push) Successful in 8m21s
All checks were successful
Deploy Website / deploy (push) Successful in 8m21s
This commit is contained in:
parent
aa4ef05b55
commit
4d27fe9bae
@ -22,13 +22,9 @@ export default function ScoreFeed() {
|
||||
}
|
||||
|
||||
setScores(prev => {
|
||||
const newScores = [...prev, commandData];
|
||||
if (newScores.length > 8) {
|
||||
newScores.pop();
|
||||
}
|
||||
|
||||
// Newest to oldest
|
||||
return newScores.sort((a, b) => parseDate(b.score.timeSet).getTime() - parseDate(a.score.timeSet).getTime());
|
||||
return [...prev, commandData]
|
||||
.sort((a, b) => parseDate(b.score.timeSet).getTime() - parseDate(a.score.timeSet).getTime())
|
||||
.slice(0, 8);
|
||||
});
|
||||
}, [lastJsonMessage]);
|
||||
|
||||
|
Reference in New Issue
Block a user