Skip to content

[Mobile] Fix play queue crash on contest/remix pages by normalizing lineup shape#14271

Merged
dylanjeffers merged 1 commit intomainfrom
claude/clever-goldstine-93c1ca
May 7, 2026
Merged

[Mobile] Fix play queue crash on contest/remix pages by normalizing lineup shape#14271
dylanjeffers merged 1 commit intomainfrom
claude/clever-goldstine-93c1ca

Conversation

@dylanjeffers
Copy link
Copy Markdown
Contributor

Summary

  • The mobile play queue drawer crashed (TypeError: page is not iterable) whenever a contest or remix page was the playback source.
  • Root cause: useRemixes stored each tan-query page as { count, tracks: LineupItem[] }, while every other lineup query (and the queue drawer / web 'Up Next' code that iterates data.pages) expects a flat LineupItem[] per page.
  • Rather than special-case the queue drawer, this PR conforms the contest/remix queries to the standard lineup pattern.

Changes

  • useRemixes now returns flat LineupData[] per page — matching useProfileTracks and friends.
  • New useRemixesCount (regular query, not infinite) carries the total count. The lineup queryFn primes the count cache so consumers reading both don't pay an extra round-trip.
  • useRemixesLineup reads count via useRemixesCount; useAllRemixContests primes the new count key.
  • Migrated all pages?.[0]?.count consumers to useRemixesCount:
    • web: ContestPage, RemixesPage (desktop), PickWinnersPage, ContestCard, ArtistRemixContestEndedNotification
    • mobile: ContestCard, TrackRemixesScreen, ContestSubmissionsTab
  • Updated ContestPage.test.tsx mocks to match.

Test plan

  • Open a contest page, play any submission, then open the play queue drawer — drawer renders, "Up Next from " populates without crashing.
  • Open a track's remixes page, play a remix, then open the play queue drawer — same as above.
  • Verify the submissions count badge on ContestCard (explore grid) and the submissions pill on the Contest page still show the correct totals (not zero, not "growing as you scroll").
  • Verify "X Remixes" header on the mobile remixes page still reflects the API total.
  • Pick Winners page: submission list still loads and paginates.

🤖 Generated with Claude Code

The mobile play queue drawer (and web "Up Next") iterates the source
query's `data.pages` expecting each page to be a flat `LineupItem[]`.
`useRemixes` instead stored `{ count, tracks: LineupItem[] }` per page,
so once a contest/remix track started playing the drawer threw
`TypeError: page is not iterable`.

Rather than unwrap the odd shape inside the queue drawer (which would
have been a one-off workaround), conform `useRemixes` to the standard
lineup-page shape used everywhere else (`useProfileTracks`, etc.):

- `useRemixes` now returns `LineupData[]` per page — same as every
  other lineup query.
- `useRemixesCount` is the new dedicated count-only query, keyed
  separately from the lineup. The lineup queryFn primes the count
  cache so consumers using both don't pay an extra round-trip.
- `useRemixesLineup` reads `count` via `useRemixesCount`.
- `useAllRemixContests` primes the new count key.
- All call sites that did `pages?.[0]?.count` now use `useRemixesCount`
  (web ContestPage / RemixesPage / PickWinnersPage / ContestCard /
  ArtistRemixContestEndedNotification, mobile ContestCard /
  TrackRemixesScreen / ContestSubmissionsTab).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 7, 2026

⚠️ No Changeset found

Latest commit: 6c8d4cb

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

🌐 Web preview ready

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

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

@dylanjeffers dylanjeffers merged commit 47a9049 into main May 7, 2026
14 checks passed
@dylanjeffers dylanjeffers deleted the claude/clever-goldstine-93c1ca branch May 7, 2026 21:10
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