fix: load saved edits (status edited/pending) from Supabase

This commit is contained in:
Christian Vidal Wolf
2026-04-23 16:16:20 +02:00
parent 56fc7d34c3
commit 7de903a184
+4 -4
View File
@@ -163,17 +163,17 @@ const articleNoIdx = resolvedCols.ARTICLE_NO;
const articleNo = String(row[articleNoIdx]);
const synced = syncedData[articleNo];
// Start with fresh Dropbox values
// Start with fresh Dropbox values (prices from Excel)
let finalRow = [...row];
// Only use Supabase value if status is 'pending' (active edit session)
if (synced && synced.status === 'pending') {
// Load manual edits: status 'edited' = saved edits, 'pending' = unsaved edits
if (synced && (synced.status === 'edited' || 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' }));
setRowStatuses(prev => ({ ...prev, [articleNo]: synced.status }));
}
return finalRow.map((val: any, idx: number) => {