Skip to content

Conversation

@deansheather
Copy link
Member

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

- 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.
@github-actions github-actions bot added the enhancement New feature or functionality label Jan 20, 2026
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a 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
@deansheather
Copy link
Member Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a 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
@deansheather deansheather added this pull request to the merge queue Jan 20, 2026
Merged via the queue into main with commit adf6db2 Jan 20, 2026
21 checks passed
@deansheather deansheather deleted the file-explorer-490p branch January 20, 2026 08:28
ethanndickson pushed a commit that referenced this pull request Jan 20, 2026
## 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`_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant