Skip to content

fix(git): prevent diff stats polling process storms - #446

Merged
J3n5en merged 2 commits into
J3n5en:mainfrom
qixing-jk:fix/diff-stats-polling
Jul 18, 2026
Merged

fix(git): prevent diff stats polling process storms#446
J3n5en merged 2 commits into
J3n5en:mainfrom
qixing-jk:fix/diff-stats-polling

Conversation

@qixing-jk

Copy link
Copy Markdown
Contributor

Summary

  • keep diff-stat polling stable across rerenders when the active worktree path set is unchanged
  • share the 30-second polling lifecycle between tree and column layouts
  • coalesce concurrent git diff --shortstat requests per worktree and reuse completed results for two seconds

Root cause

useQueries() can return a new result-array reference on each render. EnsoAI rebuilt worktreesMap from that array, and TreeSidebar treated the new map reference as a polling dependency change. Because the effect fetched immediately before starting its interval, ordinary rerenders repeatedly bypassed the intended 30-second cadence and spawned short-lived Git processes.

Validation

  • pnpm test - 68/68 tests passed
  • pnpm build - main, preload, and renderer production builds passed
  • targeted Biome check for all changed source/test files passed
  • git diff --check upstream/main...HEAD passed
  • temporary cross-layer stress harness passed twice: 100 equivalent rerenders and 33 concurrent renderer requests produced one real Git process and one shared result

Known repository baseline

  • pnpm typecheck still reports the pre-existing errors at src/renderer/App.tsx:472 and src/renderer/App.tsx:476; neither line is changed by this PR
  • repo-wide pnpm lint remains blocked by existing formatting/lint debt, while all files changed by this PR pass Biome

Risk

Diff statistics can be up to two seconds stale after a completed request. Error and empty results use the same short cache window to prevent retry storms. No production dependency or user-facing UI change is included.

@github-actions

Copy link
Copy Markdown
Contributor

Claude Code is working…

I'll analyze this and get back to you.

View job run

@J3n5en
J3n5en merged commit 9609882 into J3n5en:main Jul 18, 2026
1 check failed
@qixing-jk
qixing-jk deleted the fix/diff-stats-polling branch July 18, 2026 08:54
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.

2 participants