Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(shuffle+): update GraphQL handling #3229

Merged
merged 3 commits into from
Dec 1, 2024

Conversation

TheGoldenPatrik1
Copy link
Contributor

@TheGoldenPatrik1 TheGoldenPatrik1 commented Nov 30, 2024

  • Use tracksV2 instead of tracks (if supported) when fetching album tracks
  • Use hard-coded queryArtistDiscographyAll definition (due to Spotify v1.2.46; see this PR)

Use tracksV2 instead of tracks
Use queryArtistOverview from Definitions object
Use hard-coded queryArtistDiscographyAll definition
@jonathancaudill
Copy link

Much needed. Was waiting on a fix for this

@@ -368,12 +368,12 @@
}

async function fetchArtistTracks(uri) {
const { queryArtistDiscographyAll } = Spicetify.GraphQL.Definitions;
const { queryArtistOverview } = Spicetify.GraphQL.Definitions;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

queryArtistOverview is not available in some of supported spotify versions. revert.

@@ -338,7 +338,7 @@
if (errors) throw errors[0].message;
if (data.albumUnion.playability.playable === false) throw "Album is not playable";

return data.albumUnion.tracks.items.filter(({ track }) => track.playability.playable).map(({ track }) => (includeMetadata ? track : track.uri));
return data.albumUnion.tracksV2.items.filter(({ track }) => track.playability.playable).map(({ track }) => (includeMetadata ? track : track.uri));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is not available in all supported spotify versions.

Suggested change
return data.albumUnion.tracksV2.items.filter(({ track }) => track.playability.playable).map(({ track }) => (includeMetadata ? track : track.uri));
return (data.albumUnion?.tracksV2 ?? data.albumUnion?.tracks).items.filter(({ track }) => track.playability.playable).map(({ track }) => (includeMetadata ? track : track.uri));

@rxri rxri merged commit 631146a into spicetify:main Dec 1, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants