optimisation et probleme suppression favoris
This commit is contained in:
@@ -89,13 +89,12 @@
|
||||
|
||||
const result = await window.discogsearch(query, type, page);
|
||||
|
||||
const enrichedItems = [];
|
||||
for (const item of result.results) {
|
||||
const itemsWithFavorites = await Promise.all(result.results.map(async (item) => {
|
||||
const isFav = await window.isFavorite(item.id);
|
||||
enrichedItems.push({ ...item, isFavorite: isFav }); // évite de muter directement item
|
||||
}
|
||||
return { ...item, isFavorite: isFav };
|
||||
}));
|
||||
|
||||
this.searchs.items = enrichedItems;
|
||||
this.searchs.items = itemsWithFavorites;
|
||||
this.searchs.pagination = result.pagination;
|
||||
this.searchs.query = query;
|
||||
this.searchs.type = type;
|
||||
|
||||
Reference in New Issue
Block a user