[PR #8923] [MERGED] perf: load the character list in one slim request, no pages #8881

Closed
opened 2026-11-07 17:40:26 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8923
Author: @Gunterlie
Created: 11/6/2026
Status: ✅ Merged
Merged: 11/6/2026
Merged by: @Gunterlie

Base: staging ← Head: perf/feel-5b-slim-card-list


📝 Commits (4)

  • 0338994 perf(server): serve all slim character rows for virtualized panels
  • f28b817 perf(client): load the complete slim character panel list once
  • 18cb60d perf(client): replace startup full-card page drain with one slim catalog request
  • 992c6f6 fix(server): normalize tag filters like the search text

📊 Changes

7 files changed (+288 additions, -171 deletions)

View changed files

📝 packages/client/src/components/chat/HomeCharacterLibrary.tsx (+2 -2)
📝 packages/client/src/components/panels/CharactersPanel.tsx (+51 -112)
📝 packages/client/src/hooks/use-characters.ts (+29 -46)
📝 packages/server/src/routes/characters.routes.ts (+2 -0)
📝 packages/server/src/services/storage/character-catalog.ts (+57 -11)
📝 packages/shared/src/types/character-catalog.ts (+13 -0)
➕ scripts/regressions/character-catalog-summary.regression.ts (+134 -0)

📄 Description

Part of #8904 (slice 5, step 2). Follows #8920.

Why

  • The Characters panel still loaded cards in pages of 100 with "Load more (N of total)". Pages could not just grow: every catalog item carries the full card text (5–20 KB per real card), so all 2,700 cards would be 20–50 MB. Discord report: 100-card pages, "Load more", slow large libraries.
  • Worse, found while testing: on every app start the Home page (useAllCharacterCatalog) drained the whole catalog with full text in 31 sequential requests (7.7 MB with short seeded cards; tens of MB with real cards). This exists on staging today.

What changed

  • Server: GET /api/characters/catalog gets an opt-in view=summary. It returns all matching rows in one response with only list fields (id, name, comment, creator, version, tags, favorite, summary ≤ 200 chars, tokenEstimate, hasOnboarding, nameColor, avatarPath, avatarCrop, createdAt, updatedAt, cardSpec, cardSpecVersion). Search, tag/exclude-tag, folder and sort filters run on full data before the rows are slimmed; totals and folder counts are unchanged. Without view=summary the response and its 100-row limit are unchanged.
  • Characters panel: root list and folder lists use one summary request each; pages and "Load more" are gone, the list stays virtualized (#8920). The editor, duplicate, chat, export and bulk-tag actions use ids; the tag-removal path still fetches full cards.
  • App start: useAllCharacterCatalog (Home browser, bulk tags dialog, editor tag suggestions) makes one summary request instead of the 31-page full-text drain; every caller only reads summary fields. The unused useCharacterFolderMembers hook is removed.
  • CharacterLibraryView stays on the full paged view: its detail pane shows the full card sections.

Measured (dev box, 3,010 seeded cards)

Before After
App start, character catalog 31 requests, ~7.7 MB 1 request, 1.7 MB (110 KB gzip), ~33 ms server
Characters panel root list pages of 100 (257 KB each) + Load more 1 request, 1.5 MB, all cards, no Load more

Browser check (headless Chromium 1440×900): panel shows 12 mounted rows, no Load more, folder opens with one 170 KB summary request, search with match / no match, return from the editor; no page errors. Not measured: panel open time at 4× CPU.

Validation

  • Server and client tsc --noEmit, eslint and prettier on changed files, pnpm localization:check: pass.
  • Regressions: new character-catalog-summary, plus catalog-search, token-estimate, card-tag-search, bulk-tags and group-cache: pass.
  • Local CodeRabbit CLI auth is broken on this host; local review by a separate reviewer agent.

Manual verification

  • Manually verify the Characters panel with a large real library: all cards reachable by scrolling, no Load more.
  • Manually verify search, tag chips, exclude tags and favourites filter in the panel.
  • Manually verify folders: open, move cards in/out, counts.
  • Manually verify the Home character browser and the bulk tag dialog show the right cards and tags.
  • Manually verify editor tag suggestions.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/8923 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 11/6/2026 **Status:** ✅ Merged **Merged:** 11/6/2026 **Merged by:** [@Gunterlie](https://github.com/Gunterlie) **Base:** `staging` ← **Head:** `perf/feel-5b-slim-card-list` --- ### 📝 Commits (4) - [`0338994`](https://github.com/Pasta-Devs/Marinara-Engine/commit/0338994603928428811bcc1b389e4344c2f7bdfb) perf(server): serve all slim character rows for virtualized panels - [`f28b817`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f28b817e5116fbabd94cd30e1daceeaaccbdf560) perf(client): load the complete slim character panel list once - [`18cb60d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/18cb60de6f429625b3fe7fc1036fd9516567f270) perf(client): replace startup full-card page drain with one slim catalog request - [`992c6f6`](https://github.com/Pasta-Devs/Marinara-Engine/commit/992c6f68e12c59e50ef258e111167b6ef36b4003) fix(server): normalize tag filters like the search text ### 📊 Changes **7 files changed** (+288 additions, -171 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/chat/HomeCharacterLibrary.tsx` (+2 -2) 📝 `packages/client/src/components/panels/CharactersPanel.tsx` (+51 -112) 📝 `packages/client/src/hooks/use-characters.ts` (+29 -46) 📝 `packages/server/src/routes/characters.routes.ts` (+2 -0) 📝 `packages/server/src/services/storage/character-catalog.ts` (+57 -11) 📝 `packages/shared/src/types/character-catalog.ts` (+13 -0) ➕ `scripts/regressions/character-catalog-summary.regression.ts` (+134 -0) </details> ### 📄 Description Part of #8904 (slice 5, step 2). Follows #8920. ## Why - The Characters panel still loaded cards in pages of 100 with "Load more (N of total)". Pages could not just grow: every catalog item carries the full card text (5–20 KB per real card), so all 2,700 cards would be 20–50 MB. Discord report: 100-card pages, "Load more", slow large libraries. - Worse, found while testing: on **every app start** the Home page (`useAllCharacterCatalog`) drained the whole catalog with full text in 31 sequential requests (7.7 MB with short seeded cards; tens of MB with real cards). This exists on `staging` today. ## What changed - **Server:** `GET /api/characters/catalog` gets an opt-in `view=summary`. It returns all matching rows in one response with only list fields (`id`, `name`, `comment`, `creator`, `version`, `tags`, `favorite`, `summary` ≤ 200 chars, `tokenEstimate`, `hasOnboarding`, `nameColor`, `avatarPath`, `avatarCrop`, `createdAt`, `updatedAt`, `cardSpec`, `cardSpecVersion`). Search, tag/exclude-tag, folder and sort filters run on full data before the rows are slimmed; totals and folder counts are unchanged. Without `view=summary` the response and its 100-row limit are unchanged. - **Characters panel:** root list and folder lists use one summary request each; pages and "Load more" are gone, the list stays virtualized (#8920). The editor, duplicate, chat, export and bulk-tag actions use ids; the tag-removal path still fetches full cards. - **App start:** `useAllCharacterCatalog` (Home browser, bulk tags dialog, editor tag suggestions) makes one summary request instead of the 31-page full-text drain; every caller only reads summary fields. The unused `useCharacterFolderMembers` hook is removed. - `CharacterLibraryView` stays on the full paged view: its detail pane shows the full card sections. ## Measured (dev box, 3,010 seeded cards) | | Before | After | |---|---|---| | App start, character catalog | 31 requests, ~7.7 MB | 1 request, 1.7 MB (110 KB gzip), ~33 ms server | | Characters panel root list | pages of 100 (257 KB each) + Load more | 1 request, 1.5 MB, all cards, no Load more | Browser check (headless Chromium 1440×900): panel shows 12 mounted rows, no Load more, folder opens with one 170 KB summary request, search with match / no match, return from the editor; no page errors. Not measured: panel open time at 4× CPU. ## Validation - Server and client `tsc --noEmit`, eslint and prettier on changed files, `pnpm localization:check`: pass. - Regressions: new `character-catalog-summary`, plus catalog-search, token-estimate, card-tag-search, bulk-tags and group-cache: pass. - Local CodeRabbit CLI auth is broken on this host; local review by a separate reviewer agent. ## Manual verification - [ ] Manually verify the Characters panel with a large real library: all cards reachable by scrolling, no Load more. - [ ] Manually verify search, tag chips, exclude tags and favourites filter in the panel. - [ ] Manually verify folders: open, move cards in/out, counts. - [ ] Manually verify the Home character browser and the bulk tag dialog show the right cards and tags. - [ ] Manually verify editor tag suggestions. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 17:40:26 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#8881
No description provided.