mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-15 03:08:31 +02:00
perf: replace N ranking API calls with 1 bulk fetch per supplier
getRankingByArticles now uses GET /api/ranking?foucentrale=<code> to fetch all rankings for a supplier in a single request instead of making one request per article. For a 500-article supplier this goes from ~500 HTTP calls to 2 (count + bulk), eliminating the timeout that caused the client-side crash on large suppliers. Falls back to per-article requests if no codeFournisseur is provided or if the bulk endpoint fails. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
414bf6133d
commit
dcebf74f31
2 files changed
+47
-16
No files matched your search
@@ -35,7 +35,7 @@ export async function getProductRows(input: GetProductRowsInput): Promise<Produc
|
||||
getMensuelByArticles(articles, dateDebut, dateFin),
|
||||
getReferentielByArticles(articles),
|
||||
getCommandesByFournisseur(codeFournisseur),
|
||||
getRankingByArticles(articles),
|
||||
getRankingByArticles(articles, codeFournisseur),
|
||||
]);
|
||||
const { rankings: rankingMap, totalRankedProducts } = rankingResult;
|
||||
console.log(`[getProductRows] mensuel data for ${mensuelMap.size}/${articles.length} articles`);
|
||||
|
||||
Reference in new issue
Block a user