Skip to content

[SeerrNG #746] perf(lumen): split pages into chunks, ask the first questions early, faster Requests - #38

Open
ncbudd wants to merge 1 commit into
mainfrom
seerrng-pr-746
Open

ncbudd wants to merge 1 commit into
mainfrom
seerrng-pr-746

Conversation

@ncbudd

@ncbudd ncbudd commented Nov 29, 2026

Copy link
Copy Markdown
Owner

Mirror of snapetech-org/seerrng#746. The lumen/ tree is identical to that PR's branch. Review and discussion happen upstream; this closes once upstream merges and the sync picks it up.

Builds on #745 (branch pr/lumen-phone-layout).

Summary

Lumen loaded as one 1.7 MB script and asked its first API questions only after that script had run. This PR makes the first screen arrive sooner and the Requests page ask fewer, earlier questions.

Loading

  • Code-splitting: every page is its own chunk (React.lazy) behind a page-shaped skeleton, and the open page's chunk starts downloading with the shell. React and the router get a long-cached vendor chunk. Albums on the Search page load the Music chunk only when one is shown.
    • Measured on the production build: the entry script went from 1,726 kB (470 kB gzip) to 410 kB (110 kB gzip) plus a 262 kB (83 kB gzip) vendor chunk, before the open page's own chunk.
  • English catalog trim: a small Vite plugin (scripts/trim-english-catalog.mjs) ships only the English entries that the inline t() defaults can't stand in for. The English catalog went from 455 kB to 212 kB raw.
  • Early questions (public/lumen-boot.js): while the bundle downloads, a 1.5 kB boot script asks for the session, public settings, the Lumen config and the account's settings. The app takes each answer once (takeEarlyAnswer), and an early answer lost on the network is simply asked again.
  • Font: Figtree is served with the app (variable woff2, Latin and Latin Extended, preloaded, OFL licence included), so there are no Google Fonts connections.
  • Shared reads: apiCache.shared lets the menu and the page share one in-flight request, so the pending request count and the account settings are read once.

Requests

  • A screen's small pages are asked for together; longer lists are only asked for when the first page is full.
  • Title lookups run 8 at a time.
  • My requests shows its newest page before the whole history is in.
  • A quick return to Requests shows the last list while it is checked again.

Fixed on the way

  • Phone tabs only hide for a box someone taps into, not one a page focuses by itself. With pages arriving after the shell, Search's autofocus would otherwise hide the tab bar on a page opened straight from a link.

Testing

  • New tests:
    • loading-speed.spec.ts: the first questions start before the app loads and are each asked once; a title page reuses the account settings the menu just read; a page still downloading shows its skeleton, then the page; Requests asks for the small pages of its first screen together; My requests shows its newest page before the rest of the history; a quick return to Requests shows the last list at once; Search opened from a link keeps the phone tabs until the box is tapped;
    • trim-english-catalog.test.mjs: the plugin drops only entries that every use already spells out in English;
    • request-status.spec.ts now expects the first 20 lifecycle rows as two small pages asked for together, and service-note-heading-localization.spec.ts tells the comics capability probe apart from the catalog search.
  • Local checks on main as of today (00b4b12d1), with #745 below it:
    • Lumen tsc, build and unit tests (91): pass;
    • pnpm i18n:check and ESLint on the changed Lumen files: pass;
    • Lumen browser specs (desktop, iPhone, Android, tablet), since lazy pages touch every screen: app, loading-speed, request-status, service-note-heading-localization, mobile-navigation, request-entry-navigation, review-core, review-pages, search-localization, account-settings, admin-navigation, lumen-preferences, theme and user-route-compat. 1,459 passed, 32 failed, none of them new with this PR:
      • 28 fail the same way on #745 and on untouched main: the 4 review-core tests on every size, and "series watch rule", "Classic comic discovery bookmarks" and "Music album and artist details localize" (see #745);
      • 4 (original language and origin country on phones) were fixed by the last spec commit of #745, which landed while this run was going; rerun on this branch they pass (10 of 10 with the comic catalogue spec).
  • Live: running on the production install since 2026-11-28.

AI assistance

AI tools helped write parts of the code and tests. I reviewed the changes, ran the tests listed above, and checked it on a live install.

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.

1 participant