Skip to content

[Bugfix #400] Fix Work page startup latency and tab switch delay - #404

Merged
waleedkadous merged 1 commit into
mainfrom
builder/bugfix-400-work-page-5-7-second-startup-l
Feb 17, 2026
Merged

waleedkadous merged 1 commit into
mainfrom
builder/bugfix-400-work-page-5-7-second-startup-l

Conversation

@waleedkadous

Copy link
Copy Markdown
Contributor

Summary

The Work page had 5-7 second startup latency due to two issues: WorkView unmounting on tab switch (losing all cached data), and sequential GitHub API calls on the server. Fixed both.

Fixes #400

Root Cause

  1. Client-side: WorkView was conditionally rendered ({activeTab?.type === 'work' && <WorkView />}), causing it to unmount every tab switch and re-fetch all data from scratch on return.

  2. Server-side: Three GitHub CLI calls (gh pr list, gh issue list, gh issue list --state closed) ran sequentially in OverviewCache.getOverview(), taking 3-9 seconds on cold cache.

Fix

  1. Persist WorkView with CSS display: none toggle (matching Bugfix Terminal renders garbled output when revisiting existing tabs #205 terminal persistence pattern), keeping useOverview() state alive across tab switches.

  2. Parallelize GitHub API calls using Promise.all(), reducing cold-cache latency from ~5-7s to ~1-3s.

Test Plan

  • Regression test added (verifies parallel execution of GitHub API calls)
  • Build passes
  • All 1567 tests pass (78 test files)

Net diff: 49 additions, 10 deletions (well under 300 LOC threshold)

Two root causes fixed:

1. WorkView unmounted on tab switch (App.tsx): Conditional rendering
   `{activeTab?.type === 'work' && <WorkView />}` destroyed component
   state every tab switch. Now uses CSS display toggle (matching the
   terminal persistence pattern from Bugfix #205) to keep useOverview()
   state alive across tab switches — making switches instant.

2. Sequential GitHub API calls (overview.ts): Three `gh` CLI calls
   (PRs, issues, recently closed) ran sequentially, taking 3-9s on
   cold cache. Now uses Promise.all() to run them in parallel,
   reducing cold-cache latency to ~1-3s.
@waleedkadous
waleedkadous merged commit 8a514ed into main Feb 17, 2026
7 checks passed
@waleedkadous
waleedkadous deleted the builder/bugfix-400-work-page-5-7-second-startup-l branch February 17, 2026 17:27
waleedkadous added a commit that referenced this pull request Feb 17, 2026
findWorkspaceRoot() in config.ts always resolved worktree paths back to the
main repo via getMainRepoFromWorktree(). This caused any codev tooling running
inside a builder worktree to write files to the main tree instead of the
worktree, leading to "untracked files would be overwritten by merge" errors
after merging builder PRs (#404, #406, #370, #383).

Fix: When in a worktree, find the worktree root first (via .git marker), then
check if it has its own codev/ directory. Builder worktrees are full git
checkouts with their own codev/, so we return the worktree root. Only fall
back to the main repo if the worktree lacks codev/.
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.

Work page: 5-7 second startup latency, data filters in slowly

1 participant