From 59d5cdb2ae43917228b6aeaf287ab69123ccba8b Mon Sep 17 00:00:00 2001 From: Liam Date: Fri, 25 Oct 2024 13:38:11 +0100 Subject: [PATCH] only scroll to on leaderboard page --- .../website/src/components/leaderboard/leaderboard-scores.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/website/src/components/leaderboard/leaderboard-scores.tsx b/projects/website/src/components/leaderboard/leaderboard-scores.tsx index cba964b..35bbb68 100644 --- a/projects/website/src/components/leaderboard/leaderboard-scores.tsx +++ b/projects/website/src/components/leaderboard/leaderboard-scores.tsx @@ -105,14 +105,14 @@ export default function LeaderboardScores({ * scores when new scores are loaded. */ useEffect(() => { - if (topOfScoresRef.current && shouldFetch) { + if (topOfScoresRef.current && shouldFetch && isLeaderboardPage) { const topOfScoresPosition = topOfScoresRef.current.getBoundingClientRect().top + window.scrollY; window.scrollTo({ top: topOfScoresPosition - 75, // Navbar height (plus some padding) behavior: "smooth", }); } - }, [currentPage, topOfScoresRef, shouldFetch]); + }, [currentPage, topOfScoresRef, shouldFetch, isLeaderboardPage]); useEffect(() => { if (disableUrlChanging) {