Skip to content

Use index-based tracking for player carousel and playback queue#1924

Merged
theovilardo merged 1 commit into
masterfrom
fix/crash-queue-crash-and-album-cache
May 7, 2026
Merged

Use index-based tracking for player carousel and playback queue#1924
theovilardo merged 1 commit into
masterfrom
fix/crash-queue-crash-and-album-cache

Conversation

@theovilardo

Copy link
Copy Markdown
Collaborator

This change shifts the player UI and carousel logic from identifying tracks by ID to using their specific index in the playback queue. This improves support for queues containing duplicate songs by ensuring the UI correctly maps to the active media item.

Key changes:

  • Pass currentMediaItemIndex through UnifiedPlayerSheetLayers, FullPlayerContent, and AlbumCarouselSelection.
  • Replace ID-based carousel state (pendingCarouselSongId) with index-based state (pendingCarouselIndex).
  • Update skip prediction logic (predictSkipNextCarouselIndex, predictSkipPreviousCarouselIndex) to operate on indices instead of track IDs.
  • Implement buildQueueOccurrenceKeys in AlbumCarouselSelection to generate unique keys for carousel items, preventing stable ID collisions when the same song appears multiple times in a queue.
  • Add helper functions to resolve the current queue index by prioritizing the media player's reported index over a simple ID lookup.

This change shifts the player UI and carousel logic from identifying tracks by ID to using their specific index in the playback queue. This improves support for queues containing duplicate songs by ensuring the UI correctly maps to the active media item.

Key changes:
- Pass `currentMediaItemIndex` through `UnifiedPlayerSheetLayers`, `FullPlayerContent`, and `AlbumCarouselSelection`.
- Replace ID-based carousel state (`pendingCarouselSongId`) with index-based state (`pendingCarouselIndex`).
- Update skip prediction logic (`predictSkipNextCarouselIndex`, `predictSkipPreviousCarouselIndex`) to operate on indices instead of track IDs.
- Implement `buildQueueOccurrenceKeys` in `AlbumCarouselSelection` to generate unique keys for carousel items, preventing stable ID collisions when the same song appears multiple times in a queue.
- Add helper functions to resolve the current queue index by prioritizing the media player's reported index over a simple ID lookup.
@theovilardo theovilardo merged commit fd932f2 into master May 7, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant