fix: playlists in recently played throw errors (#11)
--------- Co-authored-by: Rem Helper <remhelper@abunchofknowitalls.com> Reviewed-on: https://git.abunchofknowitalls.com/joshuafhiggins/otunes/pulls/11
This commit was merged in pull request #11.
This commit is contained in:
1 parent
0da4909b75
commit
8fbff071ea
1 file changed
+15
-7
@@ -785,18 +785,26 @@ async function browseRecentlyPlayedItems(ctx: QueryCtx) {
|
||||
const items: (BrowseAlbum | PlaylistSummary)[] = []
|
||||
|
||||
for (const id of recentlyPlayed) {
|
||||
const album = await ctx.db.get("albums", id as Id<"albums">)
|
||||
if (album) {
|
||||
const artist = artistMap.get(album.artist)
|
||||
if (artist) {
|
||||
items.push(toBrowseAlbum(album, artist))
|
||||
const albumId = ctx.db.normalizeId("albums", id)
|
||||
if (albumId !== null) {
|
||||
const album = await ctx.db.get("albums", albumId)
|
||||
if (album) {
|
||||
const artist = artistMap.get(album.artist)
|
||||
if (artist) {
|
||||
items.push(toBrowseAlbum(album, artist))
|
||||
}
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
const playlist = await ctx.db.get("playlists", id as Id<"playlists">)
|
||||
const playlistId = ctx.db.normalizeId("playlists", id)
|
||||
if (playlistId === null) {
|
||||
continue
|
||||
}
|
||||
|
||||
const playlist = await ctx.db.get("playlists", playlistId)
|
||||
if (playlist) {
|
||||
const owner = await ctx.db.get(playlist.owner)
|
||||
const owner = await ctx.db.get("users", playlist.owner)
|
||||
items.push({
|
||||
id: playlist._id,
|
||||
title: playlist.name,
|
||||
|
||||
Reference in new issue
Block a user