mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-20 05:28:11 +02:00
feat: implement client-side grid with heatmap and associated components for product assortment revision.
This commit is contained in:
1 parent
32164572aa
commit
56b09a438d
2 files changed
+10
-6
No files matched your search
@@ -55,9 +55,11 @@ export function GridClient({ initialRows, nomFournisseur, fournisseurs, magasins
|
||||
|
||||
useEffect(() => {
|
||||
if (!isMounted) return;
|
||||
// Deep clone to avoid mutating the React prop directly across re-renders
|
||||
const rowsCopy = JSON.parse(JSON.stringify(initialRows));
|
||||
const scoredRows = computeProductScores(rowsCopy, { seuilAxeFort, bonusParAxe });
|
||||
|
||||
// Optimisation : On évite le JSON.parse(JSON.stringify()) qui est très lourd sur 1000 lignes
|
||||
// On passe directement les initialRows au moteur de score, ou on fait une copie superficielle si nécessaire.
|
||||
// Le moteur de score doit idéalement retourner de nouveaux objets.
|
||||
const scoredRows = computeProductScores([...initialRows], { seuilAxeFort, bonusParAxe });
|
||||
setRows(scoredRows);
|
||||
}, [initialRows, setRows, seuilAxeFort, bonusParAxe, isMounted]);
|
||||
|
||||
|
||||
Reference in new issue
Block a user