diff --git a/src/App.tsx b/src/App.tsx index 6c1bd3b..bda71bc 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -160,11 +160,22 @@ export default function App() { const articleNoIdx = resolvedCols.ARTICLE_NO; const processedRows = rows.map(row => { - // Simply use Dropbox values - no merge logic - // Manual edits are preserved in Supabase and shown in Change History - // but fresh Excel data takes precedence on reload + const articleNo = String(row[articleNoIdx]); + const synced = syncedData[articleNo]; + + // Start with fresh Dropbox values let finalRow = [...row]; + // Only use Supabase value if status is 'pending' (active edit session) + if (synced && synced.status === 'pending') { + editableColumns.forEach(idx => { + if (synced.data[idx] !== undefined && synced.data[idx] !== null) { + finalRow[idx] = synced.data[idx]; + } + }); + setRowStatuses(prev => ({ ...prev, [articleNo]: 'pending' })); + } + return finalRow.map((val: any, idx: number) => { if (val === undefined || val === null || val === '') return val; const header = (headers[idx] || '').toLowerCase();