Skip to content

perf: batch collection status into list endpoint + cache disk size - #128

Merged
vboctor merged 1 commit into
mainfrom
fast-collections-list
May 1, 2026
Merged

vboctor merged 1 commit into
mainfrom
fast-collections-list

Conversation

@vboctor

@vboctor vboctor commented May 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • Inline entityCount / diskSizeBytes / lastSyncRun into GET /api/collections so the Manage Collections grid renders all cards in a single round-trip.
  • Replace the row-materializing .all().length scan with a count(*) query.
  • Cache the directory size as size: (KB) in each collection's YAML; refreshed after sync / prepare / PATCH; lazy compute on cold start (write via updateCollection so concurrent edits aren't stomped).
  • Drop the per-card status fetch loop in CollectionList.tsx and read stats directly off the list payload.

Fixes #127

Test plan

  • bun run ci (markdown lint, typecheck, all test suites, UI build, worker build)
  • Open Manage Collections in the live preview: single GET /api/collections request, no per-card fan-out, no — flicker
  • Trigger a sync and confirm the cached size: in the collection YAML is refreshed after completion

🤖 Generated with Claude Code

Eliminates the N+1 fan-out on the Manage Collections page so all cards
render fully populated in a single round-trip:

- Inline entityCount / diskSizeBytes / lastSyncRun into GET /api/collections
- Replace .all().length scan with count(*)
- Cache directory size as `size:` (KB) in each collection's YAML;
  refresh after sync / prepare / PATCH; lazy compute on cold start
- Drop per-card status fetch loop in CollectionList.tsx

Fixes #127

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vboctor
vboctor merged commit 1681659 into main May 1, 2026
1 check passed
@vboctor
vboctor deleted the fast-collections-list branch May 1, 2026 01:13
@vboctor vboctor self-assigned this May 1, 2026
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.

Manage Collections page is slow and flickers due to N+1 status fetch

1 participant