-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 playing section titles bug #1289
Conversation
fetchMock.reset(); | ||
}); | ||
|
||
it('search for albums', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, this test won't do anything. You just set up a mock then run a loop on an empty array, which will not run any expects. The mock will not be consumed since there is nothing that could call it in this test.
if (track.sub_tracks) { | ||
track.sub_tracks.forEach(subTrack => tracklist.push(this.discogsTrackToGeneric(subTrack, artist))); | ||
track.sub_tracks.forEach(subTrack => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't push in a for each loop, just use map, that's what it's for.
@@ -105,6 +114,11 @@ class DiscogsMetaProvider extends MetaProvider { | |||
} | |||
|
|||
discogsTrackToGeneric(discogsTrack: DiscogsTrack, artist: string): Track { | |||
|
|||
if (discogsTrack.type_ !== 'track') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just filter out non-tracks instead of filling the list with dummy entries and then filtering them out later.
I left some comments, but ultimately I think this is not the way to go about it. We'll probably need to leave those entries, and just render them differently, since we don't want to leave them out altogether, we just need to stop adding them to the play queue. They need to still be visible in the album view, maybe rendered differently. |
Yeah, I'll try to fix this PR in some time. |
Unfortunately, I don't think I'm able to render those section titles differently, because I don't know React so much. |
Resolves #1168 at least in the discogs metadata provider.
I also created a test covering my changes.
I would be grateful if someone reviewed my code.