From 889e98b0ca9bdb20ca5de3fc6eec1cf0c9c8808e Mon Sep 17 00:00:00 2001 From: Christian Vidal Wolf Date: Tue, 12 May 2026 12:15:27 +0200 Subject: [PATCH] fix: restore CPNP No. from Supabase and simplify column filter matching in Cosmetic Items Co-Authored-By: claude-flow --- src/App.tsx | 2 +- src/components/CosmeticItemsView.tsx | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 789b728..fe6a3fe 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -233,7 +233,7 @@ const articleNoIdx = resolvedCols.ARTICLE_NO; // Merge logic: Prioritize internal control columns from syncedData or historyData // Use synced.data only if it has internal cols (>= 100), otherwise use hist - const syncedHasInternalCols = synced?.data && Object.values(COLUMNS).some(idx => idx >= 100 && synced.data[idx] !== undefined && synced.data[idx] !== null); + const syncedHasInternalCols = synced?.data && (synced.data.length > 100 || Object.values(COLUMNS).some(idx => idx >= 100 && synced.data[idx] !== undefined && synced.data[idx] !== null)); const sourceForInternal = syncedHasInternalCols ? synced!.data : (hist || synced?.data); if (sourceForInternal) { diff --git a/src/components/CosmeticItemsView.tsx b/src/components/CosmeticItemsView.tsx index 8f30150..243b1bf 100644 --- a/src/components/CosmeticItemsView.tsx +++ b/src/components/CosmeticItemsView.tsx @@ -82,13 +82,10 @@ export function CosmeticItemsView({ data, headers, onSaveRow, onCaptureState, ro (Object.entries(columnFilters) as [string, string[]][]).forEach(([colIdx, filterValues]) => { if (!filterValues || filterValues.length === 0) return; const colNum = parseInt(colIdx); - const allVals = getUniqueValues(colNum); - // If all known values selected, no filtering needed - const filterSet = new Set(filterValues); - if (filterSet.size >= allVals.length && allVals.every(v => filterSet.has(v))) return; + const filterSet = new Set(filterValues.map(f => f.trim())); result = result.filter(({ row }) => { const val = String(row[colNum] ?? '').trim(); - return filterValues.some(f => f.trim() === val); + return filterSet.has(val); }); });