From 81506c63eca664c6e8427a8a4d9a34b520826e8d Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 17:41:32 +0000 Subject: [PATCH] fix: remove skipHistoryRef that silently drops history entry after undo/redo skipHistoryRef was set to true in undo/redo but never consumed during those operations (setNodes/setEdges update transactionTabs directly without calling pushHistory). The ref stayed true indefinitely, causing the next user action's pushHistory call to silently skip recording, breaking the undo chain. Since pushHistory is never called during undo/redo operations, the skip guard serves no purpose. Removed entirely. Co-Authored-By: Nakamoto, S --- src/App.tsx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index e0aa2b7..267d1cf 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -104,17 +104,13 @@ export default function App() { const [historyState, dispatchHistory] = useReducer(historyReducer, { entries: [{ nodes: [], edges: [] }], index: 0 }); const history = historyState.entries; const historyIndex = historyState.index; - const skipHistoryRef = useRef(false); - const pushHistory = useCallback((n: Node[], e: Edge[]) => { - if (skipHistoryRef.current) { skipHistoryRef.current = false; return; } dispatchHistory({ type: 'push', nodes: n, edges: e }); }, []); const undo = useCallback(() => { const entry = historyState.entries[historyState.index - 1]; if (!entry || historyState.index <= 0) return; - skipHistoryRef.current = true; dispatchHistory({ type: 'undo' }); setNodes(JSON.parse(JSON.stringify(entry.nodes))); setEdges(JSON.parse(JSON.stringify(entry.edges))); @@ -123,7 +119,6 @@ export default function App() { const redo = useCallback(() => { const entry = historyState.entries[historyState.index + 1]; if (!entry || historyState.index >= historyState.entries.length - 1) return; - skipHistoryRef.current = true; dispatchHistory({ type: 'redo' }); setNodes(JSON.parse(JSON.stringify(entry.nodes))); setEdges(JSON.parse(JSON.stringify(entry.edges)));