fix(Playlist): avoid circular calls

This commit is contained in:
DevAndromeda 2021-08-11 11:27:51 +05:45
parent 8bfe4728dc
commit f806d1bf85
No known key found for this signature in database
GPG key ID: FA40E3EC5CB6DCD6

View file

@ -116,7 +116,7 @@ class Playlist {
* @param {boolean} [withTracks=true] If it should build json with tracks * @param {boolean} [withTracks=true] If it should build json with tracks
* @returns {PlaylistJSON} * @returns {PlaylistJSON}
*/ */
toJSON(withTracks = true) { toJSON(withTracks = false) {
const payload = { const payload = {
id: this.id, id: this.id,
url: this.url, url: this.url,
@ -129,7 +129,7 @@ class Playlist {
tracks: [] as TrackJSON[] tracks: [] as TrackJSON[]
}; };
if (withTracks) payload.tracks = this.tracks.map((m) => m.toJSON(true)); if (withTracks) payload.tracks = this.tracks.map((m) => m.toJSON(false));
return payload as PlaylistJSON; return payload as PlaylistJSON;
} }