fix: playlists in recently played throw errors #11

Merged
joshuafhiggins merged 1 commits from t3code/fix-homepage-convex-error into mobile 2026-07-14 22:13:56 -04:00
+15 -7
View File
@@ -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,