fix acc/pp being broken on new pages
Some checks failed
Deploy Website / deploy (push) Has been cancelled

This commit is contained in:
Lee 2024-10-12 15:19:15 +01:00
parent 20a0208e92
commit 1917a55725

@ -37,12 +37,18 @@ export default function Score({ player, playerScore }: Props) {
setBeatSaverMap(beatSaverMapData); setBeatSaverMap(beatSaverMapData);
}, [leaderboard.songHash]); }, [leaderboard.songHash]);
useEffect(() => {
if (playerScore?.score?.baseScore) {
setBaseScore(playerScore.score.baseScore);
}
}, [playerScore]);
useEffect(() => { useEffect(() => {
fetchBeatSaverData(); fetchBeatSaverData();
}, [fetchBeatSaverData]); }, [fetchBeatSaverData]);
const accuracy = (baseScore / leaderboard.maxScore) * 100; const accuracy = (baseScore / leaderboard.maxScore) * 100;
const pp = scoresaberService.getPp(leaderboard.stars, accuracy); const pp = baseScore == score.baseScore ? score.pp : scoresaberService.getPp(leaderboard.stars, accuracy);
return ( return (
<div className="pb-2 pt-2"> <div className="pb-2 pt-2">
{/* Score Info */} {/* Score Info */}