mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-14 16:25:16 +00:00
fix: releases section is empty when user doesn't follow any artists #1104
This commit is contained in:
parent
a8e9b824f3
commit
682e88e0c5
@ -21,16 +21,21 @@ class HomeNewReleasesSection extends HookConsumerWidget {
|
||||
userArtistsQuery.data?.map((s) => s.id!).toList() ?? const [];
|
||||
|
||||
final albums = useMemoized(
|
||||
() => newReleases.pages
|
||||
.whereType<Page<AlbumSimple>>()
|
||||
.expand((page) => page.items ?? const <AlbumSimple>[])
|
||||
.where((album) {
|
||||
return album.artists
|
||||
?.any((artist) => userArtists.contains(artist.id!)) ==
|
||||
true;
|
||||
})
|
||||
.map((album) => TypeConversionUtils.simpleAlbum_X_Album(album))
|
||||
.toList(),
|
||||
() {
|
||||
final allReleases = newReleases.pages
|
||||
.whereType<Page<AlbumSimple>>()
|
||||
.expand((page) => page.items ?? const <AlbumSimple>[])
|
||||
.map((album) => TypeConversionUtils.simpleAlbum_X_Album(album));
|
||||
|
||||
final userArtistReleases = allReleases.where((album) {
|
||||
return album.artists
|
||||
?.any((artist) => userArtists.contains(artist.id!)) ==
|
||||
true;
|
||||
}).toList();
|
||||
|
||||
if (userArtistReleases.isEmpty) return allReleases.toList();
|
||||
return userArtistReleases;
|
||||
},
|
||||
[newReleases.pages],
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user