Skip to content

fix(contests): prime correct count cache key in useUserRemixContests#14354

Open
dylanjeffers wants to merge 1 commit into
mainfrom
claude/priceless-almeida-f2e18b
Open

fix(contests): prime correct count cache key in useUserRemixContests#14354
dylanjeffers wants to merge 1 commit into
mainfrom
claude/priceless-almeida-f2e18b

Conversation

@dylanjeffers
Copy link
Copy Markdown
Contributor

Summary

The profile Contests tab's submission count badge was stuck on "0 ENTRIES" because the cache priming used the wrong query key.

  • useUserRemixContests primed getRemixesQueryKey({ pageSize: 0, isContestEntry: true }) with a fake InfiniteData shape ({ pages: [{ count, tracks: [] }], pageParams: [0] }).
  • But ContestCard reads counts via useRemixesCount, which is keyed by getRemixesCountQueryKey (a flat count, no infinite-data wrapper).
  • The keys never matched, so the primed data was unreachable. Every card fell through to its own /tracks/{id}/remixes?limit=0 request, and the badge showed 0 until that fetch resolved (or longer, if the response was slow or stalled).

Fix

Prime getRemixesCountQueryKey with the raw count instead — exactly the same shape useRemixesCount writes back from its queryFn. This mirrors the fix already applied to the companion useAllRemixContests hook 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 /contests already does.

Test plan

  • Visit a host's profile → Contests tab. Confirm each ContestCard shows the correct entry count immediately (no 0 ENTRIES flicker).
  • Confirm no per-card /tracks/{id}/remixes?limit=0 requests fire on initial load (network panel).
  • Visit /contests and confirm nothing regressed there (it already used the correct key).

🤖 Generated with Claude Code

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 18, 2026

⚠️ No Changeset found

Latest commit: 237f9c9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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>
@dylanjeffers dylanjeffers force-pushed the claude/priceless-almeida-f2e18b branch from 5bf3623 to 237f9c9 Compare May 21, 2026 03:21
@pull-request-size pull-request-size Bot added size/S and removed size/L labels May 21, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🌐 Web preview ready

Preview URL: https://audius-web-preview-pr-14354.audius.workers.dev

Unique preview for this PR (deployed from this branch).
Workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant