Skip to content

Sprint C: React Context, StagingArea refactor, CommitGraph virtualization#23

Merged
timbornemann merged 1 commit into
masterfrom
claude/gifted-euclid
Mar 25, 2026
Merged

Sprint C: React Context, StagingArea refactor, CommitGraph virtualization#23
timbornemann merged 1 commit into
masterfrom
claude/gifted-euclid

Conversation

@timbornemann
Copy link
Copy Markdown
Owner

Summary

  • C1 – React Context: Eliminated the 160-prop drilling wall through AppSidebar and MainView. Added AppStateContext.tsx with a single AppContextValue type. App.tsx now builds one context object and both AppSidebar and MainView become zero-prop components that call useAppContext().
  • C2 – StagingArea refactor: Split the 1280-line monolith into four focused hooks (useFileOperations, useCommitForm, useAiCommit, useConflictResolver). StagingArea.tsx is now ~260 lines of thin orchestration.
  • C3 – CommitGraph virtualization: Added scroll tracking via a passive listener. Only commit rows/SVG nodes/edges in the visible viewport (+ 8-row overscan) are rendered. Top and bottom spacer divs maintain correct scroll height. Fixes performance for repos with 1000+ commits.

Test plan

  • TypeScript: npx tsc --noEmit passes with zero errors
  • App navigates correctly between all tabs (repos, graph, staging, settings)
  • Staging area: stage/unstage/discard files, write commit, amend, AI commit
  • Conflict resolver opens and resolves conflicts correctly
  • CommitGraph scrolls smoothly on a repo with many commits; nodes/refs render at correct positions
  • Commit graph load-more button appears near bottom and loads more on scroll

🤖 Generated with Claude Code

…virtualization

C1: Replace 160-prop drilling with AppStateContext
- Add AppStateContext.tsx with AppContextValue type combining AppSidebarProps + extra fields
- Rewrite App.tsx to build single ctxValue and wrap in AppStateContext.Provider
- Convert AppSidebar and MainView to zero-prop components using useAppContext()

C2: Split StagingArea.tsx into focused hooks
- Extract useFileOperations (status, staging, discard, stash, diff)
- Extract useCommitForm (commit message, amend, signoff, handleCommit)
- Extract useAiCommit (AI auto-commit state, job events, cancel)
- Extract useConflictResolver (conflict editor, navigation, resolution)
- StagingArea.tsx reduced from ~1280 to ~260 lines

C3: CommitGraph virtualization
- Track scroll position and container height via passive scroll listener
- Compute visible node window with 8-row overscan
- Render only visible commit rows with top/bottom spacer divs
- Filter SVG edges and nodes to visible range only
- Fixes performance with 1000+ commit repositories

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@timbornemann timbornemann merged commit fdb9078 into master Mar 25, 2026
2 checks passed
@timbornemann timbornemann deleted the claude/gifted-euclid branch March 25, 2026 15:17
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.

1 participant