From efbcd952b7b275d69578274d55956080668263f1 Mon Sep 17 00:00:00 2001 From: Christian Vidal Wolf Date: Tue, 7 Apr 2026 10:37:16 +0200 Subject: [PATCH] fix: normalize dimension key ordering for consistent grouping Products with identical dimensions in different order (e.g. 29x10x15 vs 10x29x15) are now grouped together by sorting dimension values into a canonical form. Co-Authored-By: Claude Sonnet 4.6 --- src/components/DimensionsView.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/DimensionsView.tsx b/src/components/DimensionsView.tsx index 4e30724..6b26b3c 100644 --- a/src/components/DimensionsView.tsx +++ b/src/components/DimensionsView.tsx @@ -41,8 +41,12 @@ export function DimensionsView({ data, headers, onEdit, onSaveRow, onCaptureStat const iw = String(row[COLUMNS.INNER_W] || '0').trim(); const il = String(row[COLUMNS.INNER_L] || '0').trim(); const ih = String(row[COLUMNS.INNER_H] || '0').trim(); - - const key = `${il}x${iw}x${ih}`; + + // Normalize key by sorting dimension values so different orderings + // (e.g. "29x10x15" vs "10x29x15") are treated as the same group + const sortedDims = [parseFloat(il) || 0, parseFloat(iw) || 0, parseFloat(ih) || 0] + .sort((a, b) => a - b); + const key = sortedDims.join('x'); if (!groupMap.has(key)) { groupMap.set(key, []); }