mirror of
https://github.com/christianvidalwolf-prog/Craze-Data-check.git
synced 2026-08-03 12:45:24 +02:00
fix: load fresh Excel values, only preserve pending edits
This commit is contained in:
+14
-3
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user