Skip to content

fix(home,playlist): speed up loading of YouTube generated personal pl…#805

Open
adam-adrian wants to merge 2 commits into
ArchiveTuneApp:devfrom
adam-adrian:fix/my-mix-playlist
Open

fix(home,playlist): speed up loading of YouTube generated personal pl…#805
adam-adrian wants to merge 2 commits into
ArchiveTuneApp:devfrom
adam-adrian:fix/my-mix-playlist

Conversation

@adam-adrian

Copy link
Copy Markdown
Contributor

…aylists

Reduce blocking network work that caused ArchiveTune to take ~1 minute to show YouTube-generated personal playlists (Liked Music, My Supermix, My Mix 01-04).
Changes:

  • OnlinePlaylistViewModel: remove .completed() from initial playlist load. Show the first page immediately and set continuation = songsContinuation or continuation, letting loadMoreSongs() fetch later pages on demand.
  • Utils: lower LibraryPage.completed() maxRequests from 500 to 50 so the home "Mixes" / account-playlists row does not make hundreds of sequential continuation requests.
  • HomeViewModel: run refreshAccountIdentity() and refreshAccountPlaylistsInternal() in parallel instead of serializing the playlist fetch behind account info and channel listing.

Fixes slow loading of YouTube-generated auto playlists.

…aylists

Reduce blocking network work that caused ArchiveTune to take ~1 minute to
show YouTube-generated personal playlists (Liked Music, My Supermix,
My Mix 01-04) while Metrolist showed them quickly.

Changes:
- OnlinePlaylistViewModel: remove .completed() from initial playlist load.
  Show the first page immediately and set continuation = songsContinuation or
  continuation, letting loadMoreSongs() fetch later pages on demand. This
  matches Metrolist behavior.
- Utils: lower LibraryPage.completed() maxRequests from 500 to 50 so the
  home "Mixes" / account-playlists row does not make hundreds of sequential
  continuation requests.
- HomeViewModel: run refreshAccountIdentity() and refreshAccountPlaylistsInternal()
  in parallel instead of serializing the playlist fetch behind account info and
  channel listing.

Fixes slow loading of YouTube-generated auto playlists compared to Metrolist.
@mikooochi

Copy link
Copy Markdown
Member

Looks good overall and the performance goal makes sense. One thing I’d like checked before merge: the new parallel launch { refreshAccountIdentity() } / launch { refreshAccountPlaylistsInternal() } calls may let loading/processing flags reset before those jobs finish, so stale account/channel/playlist state could still update after another refresh or account switch starts. Could we keep them parallel but join/await them with coroutineScope/supervisorScope before clearing the flags or starting sync? Also, for the playlist change, please verify generated playlists still paginate correctly via loadMoreSongs() and consider naming the new 50 request cap as a constant with a short comment since it affects LibraryPage.completed() globally.

Apply review feedback on the generated-playlist loading fix:

- Wrap parallel refreshAccountIdentity() and refreshAccountPlaylistsInternal()
  calls in supervisorScope so isAccountLoading / isProcessingAccountData
  are not cleared before those jobs finish. This prevents stale
  account/channel/playlist state from updating after a subsequent refresh or
  account switch.
- Move the login-triggered sync to start after the scope so it runs with
  fresh account/playlist data.
- Replace the bare 50 request cap in LibraryPage.completed() with the
  named constant LIBRARY_COMPLETION_MAX_REQUESTS and add a short comment,
  since it affects all library-grid completions globally (e.g.
  FEmusic_liked_playlists / generated mixes).

Generated playlists still paginate correctly: loadMoreSongs() uses the
stored songsContinuation ?: continuation with YouTube.playlistContinuation().
@sang765 sang765 added the BUG Something isn't working label Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BUG Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants