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)));