fix(leaderboards): update & move reached_limit check (#3128)

If this PR fixes an issue, link it below. If not, delete these two
lines.
Resolves #3126 

## Description:

update & move reached_limit check

## Please complete the following:

- [X] I have added screenshots for all UI updates
- [X] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [X] I have added relevant tests to the test directory
- [X] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

wraith4081

---------

Co-authored-by: Ryan <7389646+ryanbarlow97@users.noreply.github.com>
This commit is contained in:
Wraith
2026-02-05 22:35:49 +03:00
committed by GitHub
parent b68de96c6e
commit 59e808b63b
+4 -7
View File
@@ -235,13 +235,6 @@ export async function fetchPlayerLeaderboard(
});
if (!res.ok) {
// Handle "Page must be between X and Y" error as end of list
if (res.status === 400) {
const errorJson = await res.json().catch(() => null);
if (errorJson?.message?.includes("Page must be between")) {
return "reached_limit";
}
}
console.warn(
"fetchPlayerLeaderboard: unexpected status",
res.status,
@@ -253,6 +246,10 @@ export async function fetchPlayerLeaderboard(
const json = await res.json();
const parsed = RankedLeaderboardResponseSchema.safeParse(json);
if (!parsed.success) {
// Handle "Page must be between X and Y" error as end of list
if (json?.message?.includes?.("Page must be between")) {
return "reached_limit";
}
console.warn(
"fetchPlayerLeaderboard: Zod validation failed",
parsed.error.toString(),