This commit is contained in:
parent
3b2e726fa1
commit
662999f65b
@ -71,6 +71,7 @@ export default function GlobalRanking({
|
|||||||
<Pagination
|
<Pagination
|
||||||
currentPage={pageInfo.page}
|
currentPage={pageInfo.page}
|
||||||
totalPages={pageInfo.totalPages}
|
totalPages={pageInfo.totalPages}
|
||||||
|
useHref
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -47,10 +47,16 @@ export default function Scores({
|
|||||||
sortType: initalSortType,
|
sortType: initalSortType,
|
||||||
scores: initalScores ? initalScores : [],
|
scores: initalScores ? initalScores : [],
|
||||||
});
|
});
|
||||||
|
const [changedPage, setChangedPage] = useState(false);
|
||||||
|
|
||||||
const updateScoresPage = useCallback(
|
const updateScoresPage = useCallback(
|
||||||
(sortType: SortType, page: any) => {
|
(sortType: SortType, page: any) => {
|
||||||
if (page == initalPage && sortType == initalSortType && initalScores) {
|
if (
|
||||||
|
page == initalPage &&
|
||||||
|
sortType == initalSortType &&
|
||||||
|
initalScores &&
|
||||||
|
!changedPage
|
||||||
|
) {
|
||||||
console.log("Already loaded scores, not fetching");
|
console.log("Already loaded scores, not fetching");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -76,12 +82,21 @@ export default function Scores({
|
|||||||
"",
|
"",
|
||||||
`/player/${playerId}/${sortType.value}/${page}`,
|
`/player/${playerId}/${sortType.value}/${page}`,
|
||||||
);
|
);
|
||||||
|
setChangedPage(true);
|
||||||
|
|
||||||
console.log(`Switched page to ${page} with sort ${sortType.value}`);
|
console.log(`Switched page to ${page} with sort ${sortType.value}`);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
[initalPage, initalScores, initalSortType, playerId, scores, settingsStore],
|
[
|
||||||
|
changedPage,
|
||||||
|
initalPage,
|
||||||
|
initalScores,
|
||||||
|
initalSortType,
|
||||||
|
playerId,
|
||||||
|
scores,
|
||||||
|
settingsStore,
|
||||||
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user