Skip to content

Extract reusable hooks from large controllers (useAppController, useHomeController) #56

Description

@ryuhmanov-m

Parent issue: #21

Context

useAppController.ts and useHomeController.ts are 800+ line controllers mixing multiple concerns. Extracting focused hooks improves testability and readability.

Scope

Extract these hooks into separate files under src/features/*/hooks/:

From useHomeController (~889 lines)

  • useKeyboardShortcuts — global keyboard shortcut registration and handling
  • useDragDrop — sidebar drag-and-drop logic (reorder conversations, move files)

From useAppController

  • useAppInit — app initialization sequence (vault check, model load, onboarding state)

Guidelines

  • Each hook should have a clear input/output interface
  • Keep the same behavior — this is a refactor, not a feature change
  • The parent controller should import and compose the extracted hooks
  • Add a brief JSDoc comment describing the hook's purpose

Files

  • src/features/layout/controllers/useAppController.ts
  • src/features/chat/controllers/useHomeController.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    architectureSystemic / cross-cutting changesenhancementNew feature or requestfrontendNext.js / React frontendgood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions