fix(contests): prime correct count cache key in useUserRemixContests#14354
Open
dylanjeffers wants to merge 1 commit into
Open
fix(contests): prime correct count cache key in useUserRemixContests#14354dylanjeffers wants to merge 1 commit into
dylanjeffers wants to merge 1 commit into
Conversation
|
The profile Contests tab primed `getRemixesQueryKey({ pageSize: 0,
isContestEntry: true })`, but `ContestCard` reads from
`useRemixesCount`, which is keyed by `getRemixesCountQueryKey`. The
mismatch meant primed counts were never read — every card fell through
to its own `/tracks/{id}/remixes?limit=0` request, with the badge
showing "0 ENTRIES" until that fetch resolved.
This mirrors the fix already applied to `useAllRemixContests` in
the time.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5bf3623 to
237f9c9
Compare
Contributor
🌐 Web preview readyPreview URL: https://audius-web-preview-pr-14354.audius.workers.dev Unique preview for this PR (deployed from this branch). |
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 profile Contests tab's submission count badge was stuck on "0 ENTRIES" because the cache priming used the wrong query key.
useUserRemixContestsprimedgetRemixesQueryKey({ pageSize: 0, isContestEntry: true })with a fakeInfiniteDatashape ({ pages: [{ count, tracks: [] }], pageParams: [0] }).ContestCardreads counts viauseRemixesCount, which is keyed bygetRemixesCountQueryKey(a flat count, no infinite-data wrapper)./tracks/{id}/remixes?limit=0request, and the badge showed0until that fetch resolved (or longer, if the response was slow or stalled).Fix
Prime
getRemixesCountQueryKeywith the raw count instead — exactly the same shapeuseRemixesCountwrites back from itsqueryFn. This mirrors the fix already applied to the companionuseAllRemixContestshook in #14271 ("normalize lineup shape"); the per-user hook was added separately and missed the migration.Net: counts on the profile Contests tab now paint from the primed cache in a single round-trip, the way
/contestsalready does.Test plan
ContestCardshows the correct entry count immediately (no0 ENTRIESflicker)./tracks/{id}/remixes?limit=0requests fire on initial load (network panel)./contestsand confirm nothing regressed there (it already used the correct key).🤖 Generated with Claude Code