fix: load fresh Excel values, only preserve pending edits

This commit is contained in:
Christian Vidal Wolf
2026-04-23 16:14:18 +02:00
parent 6bcf697165
commit 56fc7d34c3
+14 -3
View File
@@ -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();