fix: correctly track hasUnsavedChanges when only 1 pending change remains

This commit is contained in:
Christian Vidal Wolf
2026-04-10 10:37:40 +02:00
parent 4e6563d38d
commit bb1af0dbbd
+1 -1
View File
@@ -281,7 +281,7 @@ export default function App() {
setAppState(prev => { setAppState(prev => {
const newData = [...prev.data]; const newData = [...prev.data];
newData[pending.rowIndex] = pending.originalData; newData[pending.rowIndex] = pending.originalData;
const stillPending = Object.keys(pendingRows).length > 1; const stillPending = Object.keys(pendingRows).length > 0;
return { ...prev, data: newData, hasUnsavedChanges: stillPending }; return { ...prev, data: newData, hasUnsavedChanges: stillPending };
}); });
setPendingRows(prev => { const n = { ...prev }; delete n[articleNo]; return n; }); setPendingRows(prev => { const n = { ...prev }; delete n[articleNo]; return n; });