diff --git a/src/components/player/GlobalRanking.tsx b/src/components/player/GlobalRanking.tsx index 596ebdb..aec6076 100644 --- a/src/components/player/GlobalRanking.tsx +++ b/src/components/player/GlobalRanking.tsx @@ -5,7 +5,6 @@ import { ScoreSaberAPI } from "@/utils/scoresaber/api"; import { normalizedRegionName } from "@/utils/utils"; import dynamic from "next/dynamic"; import Link from "next/link"; -import { useRouter } from "next/navigation"; import { useCallback, useEffect, useState } from "react"; import Card from "../Card"; import Container from "../Container"; @@ -30,8 +29,6 @@ type GlobalRankingProps = { }; export default function GlobalRanking({ page, country }: GlobalRankingProps) { - const router = useRouter(); - const [error, setError] = useState(false); const [errorMessage, setErrorMessage] = useState(""); @@ -59,14 +56,16 @@ export default function GlobalRanking({ page, country }: GlobalRankingProps) { loading: false, page: page, }); - router.push( + window.history.pushState( + {}, + "", country ? `/ranking/country/${country}/${page}` : `/ranking/global/${page}`, ); }); }, - [country, pageInfo, router], + [country, pageInfo], ); useEffect(() => { @@ -151,7 +150,7 @@ export default function GlobalRanking({ page, country }: GlobalRankingProps) { key={player.rank} className="flex flex-col gap-2 rounded-md bg-gray-700 hover:bg-gray-600" > - + diff --git a/src/components/player/PlayerRanking.tsx b/src/components/player/PlayerRanking.tsx index 1f89b1c..4575f54 100644 --- a/src/components/player/PlayerRanking.tsx +++ b/src/components/player/PlayerRanking.tsx @@ -33,7 +33,7 @@ export default function PlayerRanking({ )}

store); const playerId = playerData.id; - const router = useRouter(); - const [mounted, setMounted] = useState(false); const [error, setError] = useState(false); const [errorMessage, setErrorMessage] = useState(""); @@ -65,16 +62,17 @@ export default function Scores({ playerData, page, sortType }: ScoresProps) { sortType: sortType, }); settingsStore?.setLastUsedSortType(sortType); - - router.push(`/player/${playerId}/${sortType.value}/${page}`, { - scroll: false, - }); + window.history.pushState( + {}, + "", + `/player/${playerId}/${sortType.value}/${page}`, + ); console.log(`Switched page to ${page} with sort ${sortType.value}`); }, ); }, - [playerId, router, scores, settingsStore], + [playerId, scores, settingsStore], ); useEffect(() => {