The app now supports seamless multi-repo data caching, eliminating the need to refresh when switching between repos. Data for multiple repos is cached locally and restored instantly when you switch.
repoPRCache: Map<string, Map<string, PullRequest>>- Stores PR data for each repo
- Load on startup:
loadPRCache()restores cached PR data from electron-store - Save on updates:
savePRCache()debounced (5s) to persist changes to disk - All PR updates (individual and bulk) automatically update the cache
setSelectedRepo()now instantly restores cached PRs fromrepoPRCache- No API call needed if data was previously fetched
repoIssueCache: Map<string, Map<string, Issue>>- Stores issue data for each repo
fetchIssues()adds fetched issues torepoIssueCacheupdateIssue()updates both the active map and the cache
- All recently viewed repos now sync in parallel instead of sequentially
- Much faster initial sync with multiple repos
- Progress message shows
"Syncing X/Y repos..."
- Syncs all repos in
recentlyViewedRepos+ the selected repo - Stores are updated from cache, not from API responses (optimistic updates)
✅ Instant Switching - Switch between repos without reload/refetch
✅ Persistent Cache - Data survives app restarts
✅ Parallel Syncing - Multiple repos fetch simultaneously
✅ Fast - Cached data is instantly available
✅ Smart - Only fetches when needed, respects user actions
User clicks repo → setSelectedRepo() → Restore from repoPRCache → Display instantly
Sync triggered → Fetch all repos in parallel → Update cache → Done
PR/Issue update → Update in-memory store → Debounce 5s → Save to disk
The cache stores data for:
- Currently selected repo - Always cached
- Recently viewed repos - All stored (previously limited to 3, now all)
- All fetched repos - Never cleared unless app uninstalled
Each repo cache stores the full PR/Issue objects, so with 5 repos × 100 PRs = 500 cached items in memory.
- Uses
electron-store(persistent JSON on disk) - Keys:
"prCache"and (future)"issueCache" - Auto-saves with 5-second debounce to avoid disk thrashing
- Maps maintain references to the same PR/Issue objects
- No duplication between
pullRequestsandrepoPRCache - Old repos remain cached until user manually clears them
The caching system follows the established optimistic update pattern:
- Set loading flag on object
- Call API in background
- Update from local cache (not API response)
- On error: revert only loading flag
See issueStore.ts methods like linkPRsToIssue for reference implementation.
- Manual cache clear button in Settings
- Per-repo cache size limits
- LRU eviction policy for old repos
- Compress cached data before saving