-
Notifications
You must be signed in to change notification settings - Fork 44
🤖 feat: add caching to file explorer #1783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Cache expanded folders and folder entries in localStorage - Add LRU file content cache with 50 entry limit and 30min TTL - Show refresh indicator when background-refreshing cached files - Extend text file viewer gutter/background to fill container - Add file path to tab tooltips and status bars Stale-while-revalidate pattern: cached content displays instantly, background fetch updates if changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d6d2b8a2a7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- Use TextEncoder/TextDecoder for Unicode support - Remove redundant textContent field - Add test for Unicode content
|
@codex review |
cefeaed to
a7d70e6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fdf7e97019
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- Light theme: bg-black/5 for subtle contrast - Dark theme: bg-black/20 for more visible contrast - Fix eslint exhaustive-deps warning
a7d70e6 to
3f2ea89
Compare
## Summary Add localStorage-based caching to the file explorer using stale-while-revalidate pattern. Cached content displays instantly when switching tabs, then refreshes in background. ## Changes ### Caching - **Expanded folders**: Persisted with `usePersistedState` - remembers which folders are expanded across tab switches - **Folder entries**: Cached in localStorage, initialized from cache on mount - **File contents**: New LRU cache (`fileContentCache.ts`) with 50 entry limit and 30-minute TTL ### UX Improvements - **Refresh indicator**: Spinning refresh icon when background-refreshing cached file content - **File viewer styling**: Gutter and text area backgrounds now extend to fill container height - **File path display**: Added to tab tooltips (with keybind) and file viewer status bars ### Tests - Added 18 unit tests for `fileContentCache.ts` covering: - Basic CRUD operations - TTL expiration - LRU eviction - Edge cases ## Stale-While-Revalidate Flow 1. Tab switch → render cached content immediately (no spinner) 2. Background fetch kicks off 3. Cache updates when fresh data arrives 4. Component re-renders if content differs --- _Generated with `mux` • Model: `mux-gateway:anthropic/claude-opus-4-5` • Thinking: `high` • Cost: `$12.63`_
Summary
Add localStorage-based caching to the file explorer using stale-while-revalidate pattern. Cached content displays instantly when switching tabs, then refreshes in background.
Changes
Caching
usePersistedState- remembers which folders are expanded across tab switchesfileContentCache.ts) with 50 entry limit and 30-minute TTLUX Improvements
Tests
fileContentCache.tscovering:Stale-While-Revalidate Flow
Generated with
mux• Model:mux-gateway:anthropic/claude-opus-4-5• Thinking:high• Cost:$12.63