From 1917a55725f7378503171bf5e63c8436c353a0c4 Mon Sep 17 00:00:00 2001 From: Liam Date: Sat, 12 Oct 2024 15:19:15 +0100 Subject: [PATCH] fix acc/pp being broken on new pages --- projects/website/src/components/score/score.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/projects/website/src/components/score/score.tsx b/projects/website/src/components/score/score.tsx index fa13631..57d7f73 100644 --- a/projects/website/src/components/score/score.tsx +++ b/projects/website/src/components/score/score.tsx @@ -37,12 +37,18 @@ export default function Score({ player, playerScore }: Props) { setBeatSaverMap(beatSaverMapData); }, [leaderboard.songHash]); + useEffect(() => { + if (playerScore?.score?.baseScore) { + setBaseScore(playerScore.score.baseScore); + } + }, [playerScore]); + useEffect(() => { fetchBeatSaverData(); }, [fetchBeatSaverData]); 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 (
{/* Score Info */}