added missing useAssets in Scaffold and did duplicate suppresion for play history

This commit is contained in:
Clément Le Bihan
2023-12-05 11:24:15 +01:00
parent 393782b4b8
commit 2c9ec4a7d3
3 changed files with 21 additions and 6 deletions
+15 -1
View File
@@ -36,7 +36,21 @@ const SongHistory = (props: { quantity: number }) => {
return <LoadingView />;
}
const musics = history.data.map((h) => h.song)?.slice(0, props.quantity);
const musics = history.data
.reduce(
(acc, curr) => {
if (acc.length === 0) {
return [curr];
}
if (acc.find((h) => h.song.id === curr.song.id)) {
return acc;
}
return [...acc, curr];
},
[] as typeof history.data
)
.map((h) => h.song)
?.slice(0, props.quantity);
return (
<View>