Skip to content

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

Closed

Description

@waleedkadous

Problem

The Work page in the dashboard has extremely high startup latency:

  1. Initial load: Page renders empty, then data fills in over 5-7 seconds
  2. Tab switching: Switching away and back to the Work tab takes ~5 seconds for data to reappear
  3. Perceived performance: Each section (builders, PRs, backlog) appears to load independently and sequentially rather than all at once

Expected Behavior

  • Work page should display cached data immediately on load
  • Tab switches should be instant (data already in memory)
  • Fresh data can load in the background and update in-place

Investigation Areas

  • Server-side: Overview API response time (GitHub API calls, filesystem scans)
  • Client-side: React state management, component mount/unmount on tab switch
  • Caching: Both server-side (Tower overview cache) and client-side (React state persistence)
  • Consider pre-fetching overview data on dashboard load rather than waiting for tab activation

Environment

  • v2.0.8
  • Observed on both local and remote machines

Activity

  1. waleedkadous commented on Feb 17, 2026

    @waleedkadous
    ContributorAuthor

    Root Cause Analysis

    Primary bottleneck: 3 sequential gh CLI calls on cache miss, each taking 1-2 seconds.

    Data flow

    WorkView mounts → useOverview() → GET /api/overview → OverviewCache.getOverview()
      → discoverBuilders() (50-200ms)
      → fetchPRsCached() - gh pr list (800-1500ms)
      → fetchIssuesCached() - gh issue list (800-1500ms) 
      → fetchRecentlyClosedCached() - gh issue list --state=closed (500-1000ms)
    Total: 2.5-4.5s minimum, often 5-7s
    

    Issues found

    1. Sequential fetches — PRs, issues, closed-issues not parallelized
    2. No pre-warming — cache empty until first request after restart
    3. 30s TTL — cache expires quickly
    4. No stale-while-revalidate — blocks on fresh data instead of showing stale
    5. WorkView remounts on tab switch — loses state, re-triggers fetch
    6. No background refresh — cache sits idle between requests

    Fix approach

    • Parallelize the 3 GitHub calls with Promise.all() (cuts 3x sequential to 1x parallel)
    • Pre-warm cache on Tower startup for known workspaces
    • Stale-while-revalidate — return stale data immediately, refresh in background
    • Longer TTL (2-5 min) since GitHub data doesn't change that fast
    • Persist overview state in React across tab switches (don't remount)

    Key files

    • overview.ts lines 625-678 (sequential fetches)
    • overview.ts lines 700-740 (cache with 30s TTL)
    • useOverview.ts (client fetch, 5s poll)
    • WorkView.tsx (remounts on tab switch)
    • github.ts lines 84-134 (gh CLI calls)
  2. waleedkadous commented on Feb 17, 2026

    @waleedkadous
    ContributorAuthor

    On it! Working on a fix now.

  3. added a commit that references this issue on Feb 17, 2026
  4. added a commit that references this issue on Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions