diff --git a/src/App.tsx b/src/App.tsx index d0c2806..ba480f2 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -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) => {