Skip to content

Commit

Permalink
Fix loader
Browse files Browse the repository at this point in the history
  • Loading branch information
pozylon committed Nov 6, 2024
1 parent 41296fe commit c0f2761
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/api/src/loaders/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ const loaders = async (
}),

assortmentMediasLoader: new DataLoader(async (queries) => {
const assortmentId = [...new Set(queries.map((q) => q.assortmentId).filter(Boolean))];
const assortmentIds = [...new Set(queries.map((q) => q.assortmentId).filter(Boolean))];
const assortmentMediaItems = await unchainedAPI.modules.assortments.media.findAssortmentMedias({
assortmentId,
assortmentId: { $in: assortmentIds },
});

return queries.map((q) => {
Expand Down Expand Up @@ -301,11 +301,10 @@ const loaders = async (
}),

productMediasLoader: new DataLoader(async (queries) => {
const productId = [...new Set(queries.map((q) => q.productId).filter(Boolean))];
const productIds = [...new Set(queries.map((q) => q.productId).filter(Boolean))];
const productMediaItems = await unchainedAPI.modules.products.media.findProductMedias({
productId,
productId: { $in: productIds },
});

return queries.map((q) => {
return productMediaItems.filter((i) => {
return i.productId === q.productId;
Expand Down

0 comments on commit c0f2761

Please sign in to comment.