From 4fbe7570a9ffba9bb5a41a9b8443e6429353e14c Mon Sep 17 00:00:00 2001 From: Christian Vidal Wolf Date: Thu, 30 Apr 2026 10:38:46 +0200 Subject: [PATCH] fix: resolve DataGrid product rendering failure by updating isRealSale to support CombinedKPIs and ignoring non-flat columns in filterData --- services/dataProcessor.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/dataProcessor.ts b/services/dataProcessor.ts index 885c031..94afb06 100644 --- a/services/dataProcessor.ts +++ b/services/dataProcessor.ts @@ -346,7 +346,9 @@ export const isRealSale = (record: any): boolean => { // 3. Units check: Real sales must have units. // Records with 0 units or negative units (unless it's a return, but usually returns have an ASIN) - if (!record.units || record.units <= 0) return false; + // Supports both SalesRecord (units) and CombinedKPIs (unitsTotal) + const units = record.units !== undefined ? record.units : record.unitsTotal; + if (units === undefined || units <= 0) return false; return true; }; @@ -1163,6 +1165,7 @@ export const filterData = ( // Apply selected values filter if (condition.selectedValues && condition.selectedValues.length > 0) { result = result.filter(r => { + if (!((key as string) in r)) return true; // Skip if key not in flat record const val = String((r as any)[key] || ''); return condition.selectedValues?.includes(val); }); @@ -1174,6 +1177,7 @@ export const filterData = ( const lowerValue = value.toLowerCase(); result = result.filter(r => { + if (!((key as string) in r)) return true; // Skip if key not in flat record const rowVal = String((r as any)[key] || '').toLowerCase(); switch (operator) { case 'equals': return rowVal === lowerValue;