Bugfix/leaderboard try again#4501
Conversation
… 'Try Again' footer
WalkthroughThe fetchPlayerLeaderboard function now checks for HTTP 400 responses, parses the JSON body, and returns "reached_limit" when the error message references pagination limits, instead of falling through to generic error handling. ChangesLeaderboard 400 Handling
Estimated code review effort: 1 (Trivial) | ~5 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/client/Api.ts`:
- Around line 393-404: The 400-handling in Api.ts is too broad because the
current page-related check can incorrectly map unrelated errors to
"reached_limit" and duplicates the stricter server-message check elsewhere.
Update the logic in Api.ts to use one shared helper for the reached-limit
detection and make it match the exact server text used by the existing branch
(for example, the "Page must be between" pattern) so only the intended
end-of-list response is swallowed and other 400s still surface normally.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
Resolves #4500
Description:
Fixes a pagination bug on the 1v1 Ranked leaderboard modal where scrolling near the bottom of the first page triggers an infinite fetch loop/error and permanently displays a "Try Again" button in the footer.
What was changed:
fetchPlayerLeaderboardinsrc/client/Api.tsto check if a failed response (!res.ok) is a400 Bad Requestcontaining a validation error about the page bounds."reached_limit", signaling the infinite-scroll component that it has successfully hit the end of the leaderboard pages, which stops further fetching and hides the error footer.Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
blontd6
BEFORE:


AFTER: