Skip to content

refactor(app): extract file session hook - #158

Open
SulimanAbdulrazzaq wants to merge 1 commit into
Razee4315:mainfrom
SulimanAbdulrazzaq:agent/extract-file-session
Open

refactor(app): extract file session hook#158
SulimanAbdulrazzaq wants to merge 1 commit into
Razee4315:mainfrom
SulimanAbdulrazzaq:agent/extract-file-session

Conversation

@SulimanAbdulrazzaq

Copy link
Copy Markdown

Closes #92.

What changed

  • move the active file state and tab snapshots into a typed useFileSession hook
  • move open, restore, switch, new, save, save-as, close, reopen, reorder, session persistence, autosave, and external-change behavior behind that boundary
  • keep UI-only state and link/navigation concerns in App
  • preserve the existing AI-review autosave guard when the lifecycle code moves
  • add hook-level coverage for opening, switching with dirty edits, clean close, and dirty-close confirmation

App.tsx is reduced from 2,248 to 1,513 lines; the extracted lifecycle is isolated in src/hooks/useFileSession.ts.

Validation

  • npx bun install --frozen-lockfile
  • npx bun run build — passed (tsc + Vite)
  • npx bun x vitest run src/hooks/useFileSession.test.ts — 4 passed
  • npx bun x vitest run --maxWorkers=1 — 41 files, 419 tests passed

The default parallel test command initially reached 418/419 with one unrelated DOCX export timeout; that file passed 13/13 when rerun, and the complete serialized suite then passed 419/419.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extract a useFileSession hook from App.tsx

1 participant