only scroll to on leaderboard page
All checks were successful
Deploy Website / docker (ubuntu-latest) (push) Successful in 2m23s
All checks were successful
Deploy Website / docker (ubuntu-latest) (push) Successful in 2m23s
This commit is contained in:
parent
a9338393f5
commit
59d5cdb2ae
@ -105,14 +105,14 @@ export default function LeaderboardScores({
|
|||||||
* scores when new scores are loaded.
|
* scores when new scores are loaded.
|
||||||
*/
|
*/
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (topOfScoresRef.current && shouldFetch) {
|
if (topOfScoresRef.current && shouldFetch && isLeaderboardPage) {
|
||||||
const topOfScoresPosition = topOfScoresRef.current.getBoundingClientRect().top + window.scrollY;
|
const topOfScoresPosition = topOfScoresRef.current.getBoundingClientRect().top + window.scrollY;
|
||||||
window.scrollTo({
|
window.scrollTo({
|
||||||
top: topOfScoresPosition - 75, // Navbar height (plus some padding)
|
top: topOfScoresPosition - 75, // Navbar height (plus some padding)
|
||||||
behavior: "smooth",
|
behavior: "smooth",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [currentPage, topOfScoresRef, shouldFetch]);
|
}, [currentPage, topOfScoresRef, shouldFetch, isLeaderboardPage]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (disableUrlChanging) {
|
if (disableUrlChanging) {
|
||||||
|
Reference in New Issue
Block a user