mirror of
https://github.com/christianvidalwolf-prog/Craze-Data-check.git
synced 2026-08-03 11:55:23 +02:00
fix: load saved edits (status edited/pending) from Supabase
This commit is contained in:
+4
-4
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user