mirror of
https://github.com/christianvidalwolf-prog/Craze-Data-check.git
synced 2026-08-03 15:05:23 +02:00
fix: add debug logs to handleSaveAll to diagnose save issue
This commit is contained in:
+9
-1
@@ -289,12 +289,18 @@ export default function App() {
|
||||
};
|
||||
|
||||
const handleSaveAll = async () => {
|
||||
console.log('[handleSaveAll] Starting save, pendingRows:', pendingRows);
|
||||
const entries = Object.entries(pendingRows) as [string, { rowIndex: number; originalData: ExcelRow; newData: ExcelRow; articleName: string }][];
|
||||
if (entries.length === 0) return;
|
||||
if (entries.length === 0) {
|
||||
console.log('[handleSaveAll] No entries to save, returning');
|
||||
return;
|
||||
}
|
||||
setIsSavingAll(true);
|
||||
let allSuccess = true;
|
||||
for (const [articleNo, { newData, originalData, articleName }] of entries) {
|
||||
console.log('[handleSaveAll] Saving article:', articleNo);
|
||||
const success = await saveRowToSupabase(articleNo, newData);
|
||||
console.log('[handleSaveAll] Save result for', articleNo, ':', success);
|
||||
if (success) {
|
||||
// Also save to history
|
||||
await saveHistoryEntry(articleNo, articleName, originalData, newData, session?.user?.email || 'unknown');
|
||||
@@ -306,8 +312,10 @@ export default function App() {
|
||||
allSuccess = false;
|
||||
}
|
||||
}
|
||||
console.log('[handleSaveAll] Finished, allSuccess:', allSuccess);
|
||||
if (allSuccess) setAppState(prev => ({ ...prev, hasUnsavedChanges: false }));
|
||||
setIsSavingAll(false);
|
||||
console.log('[handleSaveAll] isSavingAll set to false');
|
||||
};
|
||||
|
||||
const captureState = (message: string) => {
|
||||
|
||||
Reference in New Issue
Block a user