tvillarete / ipod-classic-js

An iPod Classic emulator that connects to Apple Music and Spotify. Built with React & Styled Components
http://tannerv.com/ipod
MIT License
1.43k stars 100 forks source link

Sort ArtistsView alphabetically #136

Closed ejb closed 1 year ago

ejb commented 1 year ago

This fixes #129, where the ArtistsView was out of order (at least with Spotify).

vercel[bot] commented 1 year ago

Someone is attempting to deploy a commit to a Personal Account owned by @tvillarete on Vercel.

@tvillarete first needs to authorize it.

tvillarete commented 1 year ago

Hey @ejb, thanks for the pull request! I'd love to have artists sorted alphabetically, but I think this approach will actually introduce new, different issues even if it does sort the artists list.

The API requests I make to Spotify are paginated, which means that while this does sort the initial list of artists, once I fetch the next 25+ artists, it will then need to sort the entire list again, which will cause list items to shift around and potentially cause users to select a different item than the one they had highlighted.

The absolute fix for this would be to request that Spotify returns the results in a sorted order, but for some odd reason they don't seem to support a sort_by query parameter on their /following API endpoint (The one used to fetch a user's artists). So I don't think there is currently a path forward here and therefore I'm going to close this PR. But thank you again for the contribution, and hopefully Spotify adds some built-in support for this in the future!