Skip to content

[Frontend] -- Implement Undo/Redo Functionality #855

@Devsol-01

Description

@Devsol-01

Description

Add undo/redo functionality for user actions to improve UX and reduce anxiety about making mistakes.

Actions to Support

  • Form edits (before submission)
  • Filter changes
  • Settings changes
  • Goal edits
  • Draft transactions

Tasks

  • Implement undo/redo state management
  • Add undo/redo UI indicators
  • Implement keyboard shortcuts (Ctrl+Z, Ctrl+Shift+Z)
  • Add undo toast notifications
  • Limit undo history (e.g., last 20 actions)
  • Persist undo history in session storage
  • Handle edge cases (page refresh, etc.)
  • Document undo-able actions

Technical Implementation

const useUndoRedo = <T,>(initialState: T) => {
  const [history, setHistory] = useState<T[]>([initialState]);
  const [currentIndex, setCurrentIndex] = useState(0);
  
  const undo = () => { /* ... */ };
  const redo = () => { /* ... */ };
  const addToHistory = (newState: T) => { /* ... */ };
  
  return { state: history[currentIndex], undo, redo, canUndo, canRedo };
};

Acceptance Criteria

  • Undo/redo works for major actions
  • Keyboard shortcuts implemented
  • UI shows undo/redo availability
  • Toast shows what was undone
  • History limited to prevent memory issues
  • Works across page navigation
  • Edge cases handled gracefully
  • Documentation for users

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions