diff --git a/apps/master-api/src/viewer/service.ts b/apps/master-api/src/viewer/service.ts index e35b03d..6e39c59 100644 --- a/apps/master-api/src/viewer/service.ts +++ b/apps/master-api/src/viewer/service.ts @@ -692,8 +692,19 @@ export class ViewerService { }); } - for (const shelf of ordered) { - const items = await this.shelfItems(shelf.id, shelf.kind, 48, kidsMode); + // Plank-items parallel laden (volgorde van `ordered` blijft behouden via Promise.all-index). + // Favorites hangt niet van planken af → tegelijk ophalen i.p.v. erna. + const [shelfPayloads, favorites] = await Promise.all([ + Promise.all( + ordered.map(async (shelf) => { + const items = await this.shelfItems(shelf.id, shelf.kind, 48, kidsMode); + return { shelf, items }; + }) + ), + this.listFavorites(profileId, kidsMode), + ]); + + for (const { shelf, items } of shelfPayloads) { if (items.length) { const homepageLabel = shelf.homepageName?.trim(); rows.push({ @@ -711,7 +722,7 @@ export class ViewerService { continueWatching: continueItems, spotlight, shelves: rows, - favorites: await this.listFavorites(profileId, kidsMode), + favorites, }; }