Skip to content

🎧 Your Personal Streaming Service

Only refresh smart playlist when fetching first track (#3244)

Kendall Garner9f1794b97ee2
diff --git a/server/nativeapi/playlists.go b/server/nativeapi/playlists.go
index 8f625aba1..09d8f8e16 100644
--- a/server/nativeapi/playlists.go
+++ b/server/nativeapi/playlists.go
@@ -22,14 +22,16 @@ type restHandler = func(rest.RepositoryConstructor, ...rest.Logger) http.Handler
func getPlaylist(ds model.DataStore) http.HandlerFunc {
// Add a middleware to capture the playlistId
wrapper := func(handler restHandler) http.HandlerFunc {
- return func(res http.ResponseWriter, req *http.Request) {
+ return func(w http.ResponseWriter, r *http.Request) {
constructor := func(ctx context.Context) rest.Repository {
plsRepo := ds.Playlist(ctx)
- plsId := chi.URLParam(req, "playlistId")
- return plsRepo.Tracks(plsId, true)
+ plsId := chi.URLParam(r, "playlistId")
+ p := req.Params(r)
+ start := p.Int64Or("_start", 0)
+ return plsRepo.Tracks(plsId, start == 0)
}
- handler(constructor).ServeHTTP(res, req)
+ handler(constructor).ServeHTTP(w, r)
}
}