[FEATURE SUGGESTION] speed up loading of playlists from like's panel with representation=compact
quick win
In the likes panel, when you click the "add to playlist" bookmark icon
there is a delay as it is fetches /playlists.json. Once the call comes back, the initially empty playlist div expands and fills with playlist data
This part of the user experience could be improved upon.
This can be slow (especially if the user has many playlists, or any playlists with many tracks). A quick win would be returning the playlist data without the track info. This can be accomplished by adding the query parameter &representation=compact to the api call made by clicking the bookmark button. This filter is documented in the playlist api: https://developers.soundcloud.com/docs/api/reference#playlists. Actual track data in this portion of the likes panel is, as far as I can tell (please note I am new to node/angular), useless.
perhaps down the road
A future step could be storing playlist data locally, but I don't see an obvious lightweight way to check for changes. A user has a playlist count attribute but that is not helpful, checking it could only be used to diff say 3 vs 4 playlists; a fetch is still necessary. I checked the api documentation for a way to see that items were added to playlists but don't see that it is logged to activities, or any kind of published audit log.
I know full playlist data is also fetched when the playlists panel is clicked. Perhaps an optimization would be to fetch playlist data on app load so it can be used in the likes and playlists panels. When the playlist panel is selected, one could then do a background fetch of the full playlist data including tracks.
Last thing could possibly be done using web workers, but then we need to update nwjs to the latest version.
+1 to this. I think it would make sense to cache a user's playlists; you could still submit a request for the most recent data, but that could then be merged into the cached playlists. This would allow you to display the last seen data immediately and then update if necessary.
@bportnoy yes, and if we don't fetch tracks when pulling playlist data (by passing representation=compact) the json returned is way smaller. that would be a quick fix :) I don't know the code well enough though to know the impact but I can't imagine it being too much as we're making requests on each tab (playlists, likes, tracks). Feedback/suggestions/welcome. If not, I will eventually submit a PR.