veza/apps/web/src/docs/UNDOREDO_UTILITY_AUDIT.md
senke 4e24f12891 state-utilities: audit undoRedo and stateNormalization utilities
- Audited undoRedo utility: completely unused (no imports found)
  - Only type exports remain (WithUndoRedo) but also unused
  - Previously removed from Library Store in Action 4.1.2.5
  - Safe to remove (Action 4.6.1.10)
- Audited stateNormalization utility: only used in outdated test
  - Only createEmptyNormalized used in stores.test.ts
  - Tests check obsolete Library Store structure (items/favorites)
  - Library Store migrated to React Query in Action 4.1.2.6
  - Safe to remove after updating test file (Action 4.6.1.12)
- Created audit documentation:
  - apps/web/src/docs/UNDOREDO_UTILITY_AUDIT.md
  - apps/web/src/docs/STATENORMALIZATION_UTILITY_AUDIT.md
- Actions 4.6.1.9 and 4.6.1.11 complete
2026-01-15 19:33:39 +01:00

1.6 KiB

UndoRedo Utility Audit

Date: 2025-01-27
Action: 4.6.1.9
Status: Complete

Summary

The undoRedo utility (apps/web/src/utils/undoRedo.ts) is completely unused in the codebase. It was previously used by the Library Store but was removed when domain data was migrated to React Query (Action 4.1.2.5).

Usage Analysis

Imports

  • No imports found in production code
  • No imports found in test files
  • Only mentioned in comments/docs indicating it was removed

Type Exports

  • WithUndoRedo<T> type exported in:
    • apps/web/src/stores/types.ts (line 14)
    • apps/web/src/stores/index.ts (line 28)
  • These type exports are not used anywhere

Functions Exported

  1. undoRedo() - Zustand middleware for undo/redo functionality
  2. useUndoRedo() - React hook for undo/redo
  3. UndoRedoManager - Global undo/redo manager class
  4. undoRedoManager - Singleton instance

All functions are unused.

Historical Context

  • Previously used by Library Store for undo/redo functionality on domain data
  • Removed in Action 4.1.2.5 when Library Store domain data was migrated to React Query
  • React Query handles state management, making undo/redo middleware unnecessary

Recommendation

Safe to remove - The utility is completely unused and can be deleted along with:

  • apps/web/src/utils/undoRedo.ts (278 lines)
  • WithUndoRedo<T> type from apps/web/src/stores/types.ts
  • WithUndoRedo export from apps/web/src/stores/index.ts

Next Steps

  • Action 4.6.1.10: Remove undoRedo if unused (confirmed unused)