Skip to content

refactor: replace shallow SWR hooks with domain modules (Phase 5) #297

@ivannissimrch

Description

@ivannissimrch

Problem

20+ individual hooks each wire their own loading/error/mutation plumbing. No shared cache key ownership. Components manage hook complexity instead of just rendering.

Solution

Replace with domain modules:

  • hooks/lessons/useLessons.ts — exports useLesson(id), useLessons(), useCreateLesson(), useUpdateLesson(), useDeleteLesson()
  • hooks/assignments/useAssignments.ts
  • hooks/users/useUsers.ts
  • hooks/lists/useLists.ts
  • hooks/practiceWords/usePracticeWords.ts

Each module owns its cache keys and invalidation strategy.

Commits

28: Move useAddLesson + useEditLesson into hooks/lessons/, update imports
29: Create useLessons.ts domain module, migrate components one at a time
30: Delete old individual lesson hooks
31-35: Repeat for assignments, users, lists, practiceWords domains

Part of architecture roadmap

#292 — Phase 5

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions