Skip to content

fix(desktop): remove server-side status cache that caused stale sidebar data - #1568

Merged
Kitenite merged 1 commit into
mainfrom
kitenite/sidebar-invalidate-or-refetch-force
Feb 18, 2026
Merged

Kitenite merged 1 commit into
mainfrom
kitenite/sidebar-invalidate-or-refetch-force

Conversation

@Kitenite

@Kitenite Kitenite commented Feb 18, 2026 •

Copy link
Copy Markdown
Member

Summary

  • The sidebar's getStatus query had a 2-second server-side cache that returned stale git state after mutations (stage, unstage, commit, push, etc.)
  • When a mutation completed and the client called refetch(), the server returned cached data because the TTL hadn't expired
  • The 2.5s client-side polling interval already rate-limits queries, making the server cache redundant

Changes

  • apps/desktop/src/lib/trpc/routers/changes/status.ts: Removed the statusCache Map, STATUS_CACHE_TTL_MS constant, and all cache read/write logic from getStatus

Test Plan

  • Stage/unstage a file and verify the sidebar updates immediately
  • Make a commit and verify staged files clear from the sidebar without delay
  • Push/pull and verify counts update promptly
  • Verify no perceptible performance regression from removing the cache

Summary by CodeRabbit

  • Chores
    • Removed caching layer from status computation to retrieve updated status on each request.

…ar data

The 2s server-side cache in getStatus returned stale git state after
mutations (stage, unstage, commit, etc.) since refetch() hit the cache
before it expired. The 2.5s client-side polling interval already
rate-limits queries, making the server cache unnecessary.
@coderabbitai

coderabbitai Bot commented Feb 18, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

This pull request removes server-side caching from the getStatus endpoint in the changes router. The STATUS_CACHE_TTL_MS constant, statusCache instance, and cache lookup/storage logic are eliminated, causing the function to always compute and return a fresh GitChangesStatus object instead of serving cached results.

Changes

Cohort / File(s) Summary
Cache removal
apps/desktop/src/lib/trpc/routers/changes/status.ts
Removed server-side caching mechanism including cache TTL constant, cache instance, cache lookup logic, and cache storage calls. Function now directly returns computed GitChangesStatus without intermediate caching layer.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 No cache today, fresh answers bloom,
Each call computes, banishing gloom,
The rabbit hops with lighter code,
Down simplicity's cleaner road! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: removing server-side status cache that was causing stale sidebar data.
Description check ✅ Passed The PR description effectively explains the problem, rationale, and changes made, with a clear test plan, though it lacks formal sections matching the template structure.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch kitenite/sidebar-invalidate-or-refetch-force

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Kitenite
Kitenite merged commit 36ae85f into main Feb 18, 2026
6 checks passed
@Kitenite
Kitenite deleted the kitenite/sidebar-invalidate-or-refetch-force branch February 18, 2026 19:49
@github-actions

Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ⚠️ Neon database branch
  • ⚠️ Electric Fly.io app
  • ⚠️ Streams Fly.io app

Thank you for your contribution! 🎉

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