Editor undo/redo is non-functional (history never advances, no state snapshots taken) #70
Labels
No labels
blocked:commit-ready-failed
blocked:gate-fetch
blocked:gate-lint
blocked:gate-plan
blocked:gate-research
blocked:needs-attention
blocked:needs-decision
blocked:needs-human
blocked:no-changes
blocked:verify-failed
bug
deferred
feature-request
in-progress
needs-decompose
needs-triage
quickfix
security/medium
triage-approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Mark/Kimi_Agent_Brother_10_Digitizing_App#70
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Where:
src/pages/Editor.tsx:28-29(historyis frozen at length 1) and:229-239(handleUndo/handleRedo).Bug:
const [history] = useState<StitchPath[][]>([DEMO_PATHS])— length is permanently 1.handleUndoearly-returns unlesshistoryIndex > 0(always 0).handleRedoearly-returns unlesshistoryIndex < history.length - 1(always 0 < 0).handleNodeDrag,handleAddNodeAt,handleDeleteSelectedNodes,handleUpdateNodeType,handleAddNodeToSelection,handleFinishPath) push to history.Fix consistent with existing patterns:
Copy
pushHistoryfromuseWorkspace.ts:118-127. Concretely:historyfromuseState<StitchPath[][]>([DEMO_PATHS])to[history, setHistory] = useState<StitchPath[][]>([])and seed it on first path-mutating action.setHistory(h => { const next = h.slice(0, historyIndex + 1); next.push(deepClone(paths)); return next.length > 50 ? next.slice(next.length - 50) : next; }); setHistoryIndex(i => i + 1).handleUndo:setPaths(deepClone(history[historyIndex - 1])); setHistoryIndex(i => i - 1).handleRedo: symmetric.Reference impl lives at
useWorkspace.ts:118-127, 244-264. Apply the same shape here.