github hankscafe/omnibus v1.1.0-beta.070
Omnibus v1.1.0-beta.070

latest release: v1.1.0-beta.071
5 hours ago

v1.1.0-beta.070 - perf: speed up library loading as the library grows

⚡ Index the columns the library sorts and filters on

  • The library's default view sorts by Series.name, but there was no index on it — so every paged load (including each infinite-scroll fetch) full-scanned and sorted the entire filtered series set just to take 24 rows, and deep OFFSET pages re-scanned from the top. Same gap for the year sorts / era range filters and the publisher filter. Added @@index([name]), @@index([year]) and @@index([publisher]) to Series so pagination walks the index instead of sorting the whole table. (Applied automatically by the container's prisma db push at startup — no migration, non-destructive.)

🗂️ Stop re-deriving the publisher dropdown on every fetch

  • The publisher list is global (independent of filters/pagination) but was recomputed via a distinct scan over the whole Series table on EVERY request — including every infinite-scroll append, where it never changes. Now computed only on page 1; later pages omit the key entirely (not [], so the client's if (data.publishers) guard doesn't wipe the dropdown mid-scroll) and reuse the list they already have. Filter changes reset to page 1, so the list still refreshes whenever it could actually change.

📊 Derive card counts from aggregates instead of loading every issue row

  • The list include-loaded ALL issues (id, coverUrl, filePath + a per-issue read-progress join) for the 24 series on a page just to count them in JS — so one page could pull thousands of rows for large/manga series, on every scroll. Replaced with two groupBy aggregates over the page's series IDs (downloaded count, and read count via readProgresses) that each return ≤24 rows regardless of issues-per-series, plus a fallback-cover lookup that runs only for series lacking a series-level cover. Output is identical: count = downloaded, unreadCount = downloaded − read, progressPercentage = round(read/downloaded×100), isPendingReq = downloaded === 0, cover fallback = one downloaded issue's cover. (filePath is only ever a real path or null, so filePath: { not: null } matches the prior .trim() guard exactly.)

🧪 Tests

  • New: library cards derive count/unreadCount/progressPercentage from the grouped aggregates (downloaded=10, read=4 → count 10, unread 6, progress 40%). Updated both library-route test mocks to provide prisma.issue (groupBy + findMany).

✅ Verification

  • tsc clean; prisma schema valid; vitest 298 passed (+1)

Don't miss a new omnibus release

NewReleases is sending notifications on new releases.