Refetch round leaderboard when round id resolves#287
Open
PunchTheDev wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
Round standingspanel on/problems/:roundIdand the round-tab leaderboard on/rankings?tab=:roundIdwere silently invisible on first paint.useApionly re-fires on its internaltickcounter, so when the inline fetcher() => round ? api.roundLeaderboard(roundId_) : Promise.resolve(null)ran during initial render — beforeallRoundshad populated androundresolved — it resolved tonulland never re-fetched until the 30–60s interval ticked.This patch extends
useApiwith an optionaldepsarray and threads[round?.id]/[activeRoundId]through the two call sites that gate their fetcher on a value that arrives asynchronously.Changes
useApi.ts: 3rd paramdeps: unknown[] = [], spread into the effect deps. Default[]preserves existing call-site behavior for every other caller.App.tsxCategoryPage (/problems/:roundId): pass[round?.id]so the round leaderboard fires the moment the round resolves fromallRounds.App.tsxRankingsPage round-tab fetch: pass[activeRoundId]so switching round tabs triggers an immediate fetch, not a 30s wait.BACKLOG.md:Round-level SOTA chart (RoundStandingsPanel)flipped from○ ○ ○to● ● ●.Verification
Puppeteer at 1440×900:
/problems/round_001—/rounds/round_001/leaderboard 200fires immediately; panel renders#1 PunchTheDev · 1/15 · 0.967(was missing entirely pre-patch, network trace confirmed the request was never made)./rankings?tab=round_001— same endpoint hit immediately; standings table populated.