Skip to content

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

Open
ncbudd wants to merge 18 commits into
snapetech-org:mainfrom
ncbudd:pr/lumen-speed
Open

ncbudd wants to merge 18 commits into
snapetech-org:mainfrom
ncbudd:pr/lumen-speed

Conversation

@ncbudd

@ncbudd ncbudd commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

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 feat(lumen): compact phone filters, calmer detail pages and fewer folded boxes #745 below it:
  • 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.

…chips

On phones, Movies and Series show only the availability switch and a
Filters button with a count. Sort, genres, network, status and More
Filters open in a bottom sheet, with Clear and Done at its foot. Each
filter in use shows as a removable chip on one scrolling line. Desktop
and tablet layouts are unchanged.
…ns the menu

The chip row under the Discover search now links only to the media pages
this server has. Coming Soon and Share & Identify were already in the
sidebar and phone More menu; Provider Discovery is added there.
A shared PhoneFilterBar keeps the control people switch most on the
page, puts the rest in a bottom sheet and shows removable chips for
filters that narrow the list. Comics keeps the type switch, Books the
library switch, Music the release types and Requests the status chips.
Podcast categories and other long chip lists scroll on one line. Stacked
sheets keep the page inert until the last one closes, and Escape closes
the top one.
…arth play links

Music sections sat 60px apart because the tab panel's display:contents
wrapper picked up the section margin rule on top of the page grid gap;
it now uses the grid gap alone. Play opens in moves from the Music page
to When you press Play on the You page, and Lumen settings gains Music
apps: which of Aurral, Plex and Hearth people may pick, plus the
default. Shelf is now Hearth, with Android intent links to Hearth's play
routes and the saved value kept as shelf. Music Discover gets release
type, sort, genre, dates and in-library filters that open the catalogue
list; Podcasts gets a Following filter on the chart.
… long text

TV, movie, book, artist and comics detail pages keep their main and
everyday actions on phones and put indexer search, blocklist, issue
reports, associations, management and similar actions in one More sheet.
Status pills share one scrolling line, long descriptions show four lines
with Show more, and disclosures no longer stack an extra 28px margin on
the grid gap. Account settings get jump links to the list imports,
linked from You. Moving the detail actions into their own containers
also stops duplicate React keys from leaving stale Watchlist buttons on
movie pages.
…ion chips

The section margin rule also skipped .dcols columns, which stacked 28px
on their 22px grid gap between Starring, Crew and Subject Tags. Wider
screens keep the detail actions visible but in their own group, set
apart from the ratings, with ratings and actions at one 36px height.
…arch

- More never holds a single item: one action shows in place
- Account and Lumen settings fold their sections on phones; jump links
  and #section addresses open the section they point to
- Search: empty Book Series hidden, partial service failures become one
  quiet note with Retry, sort is a chip on phones, no gap above results
- Phone toolbars let long button labels wrap (French metadata page)
- Member pass spec (request + auto-approve only) on every size
…ions

- User Settings on phones: the toolbar links and the jump chips become one
  sideways-scrolling row, Import lists first, nothing listed twice
- A run of collapsed sections or closed panels sits 10px apart in a page
  or detail body instead of the container's full gap
- Gap test covers Account and Lumen settings
…tings

Detail pages (movie, series, album and the rest that share the top):
- the description sits right under the title, two lines with Show more,
  instead of lower down or in a folded Overview box
- the dot line never starts or ends a wrapped line with a dot, and empty
  items (no genres) leave no stray dot
- Discover's previous/next are a labelled pair at the top corner of the
  art instead of loose arrows under the genres
- status, ratings and the small actions flow as one wrapping group: no
  chip cut off at a scroller's edge, and a lone More sits beside them;
  phones show the top two ratings and +N for the rest
- scrolled down, the back button joins a solid bar with the title so it
  never covers the content
- the sticky bar keeps every button on one line; the title gives way, and
  Manage keeps only its icon when three buttons share a phone bar
- Series Collections shows only when the series is in one, with the same
  chevron as the other boxes; the Episode Queue chip is short
Album pages: ratings are a chip row by the status and sources without a
rating are left out; song rows use a small get button; long albums show
ten songs, then All N songs.
Requests: a row's buttons run under the whole row instead of down the
narrow text column.
Discover: no Title View chip on the shelves (it stays under You >
Appearance; touch screens always show titles).
… on phones

- movie: one availability chip when HD and 4K are both on the server
  ("On Plex · HD + 4K"); phones show the best-known rating (IMDb) and +N;
  Playback Options moves into More, and More is a small icon chip
- Show more under a short description is a small text link
- album: View Artists and Subject Tags come after the songs
- phones: a shorter strip of art above the poster
- You and Administration: each settings group folds behind its title on
  phones (still a heading); folded groups sit close together
- person: each filmography group shows 12 titles, then Show all (N)
- person: the credits list is kept while it refreshes, so a bulk request's
  result stays on screen instead of vanishing with a remount
Specs open folded groups (tests/browser/phoneSections.ts) or expand first
and keep their checks.

Also: Discover's previous/next shows only the arrow that leads
somewhere. Specs open the folded You and Administration groups (also
after tab taps) and accept the combined HD + 4K chip.
…repeated Requests sentence

- folded boxes on a detail page stack 8-10px apart as one list
- phones: with two or more buttons the sticky bar drops the squeezed title;
  the main button keeps its full label
- phones: the Requests sentence that repeats the list's order is hidden
Detail pages:
- Movie and TV: Starring and Crew are one Cast & Crew box. Movie/Series Details,
  Subject Tags and (TV) Media Server are one Details box. Collection stays.
- Album: one Credits & Details box (album facts, artists, subject tags) right
  under the songs, 10px from the last song on phones.
- Book: Subjects moves into the Details box.
- Parts of a combined box keep a small heading (bare mode of VideoDisclosure,
  CreditsDisclosure and SubjectTagsDisclosure).

Saved "Keep open" choices carry over: Cast & Crew uses the cast key and also
opens for a saved crew choice; Details uses the details key and also opens for
saved subject tag, media server (TV) and artist (album) choices. Closing a box
for good clears the merged keys too. #crew and #mediaServer links open the
combined box at that part.

You and Administration on phones:
- You folds the nine admin groups into one "All Settings and Tools" box and
  Discover, Library, Acquisition and Support into "Library & Tools"
  (17 folds -> 6).
- Administration folds TV, books, music and software services into one
  "Media Services" box (9 folds -> 6).
- Wider screens keep every group as its own section, as before.

Specs open the combined Cast & Crew, Details and Credits & Details boxes
and match the You Library heading exactly next to Library & Tools.
- Book, ebook, audiobook, manga and comic descriptions show three lines with
  Show more (the shared ClampText).
- Edition and narration pickers show the first four rows, then
  "All N editions" / "All N narrations"; the selected row always stays in view.
- The stack of per-narrator Follow buttons is one Follow button under the list,
  for the selected narrator (else the owned one, else the first solo narrator).
- The ebook page shows its edition as one card, like a single-edition manga.
- Switching format on a book opened without a lookup title no longer blanks the
  page for a fresh SeerrNG lookup: the saved answer shows while the titled one
  loads, and pointing at or touching the format link asks for it ahead.
…ions

Book, ebook and audiobook pages now read like the manga page: overview right
under the format cards and action row, then the edition or narrator list, then
Collection and Advanced Request Options, then Details. Advanced Request Options
gets the same chevron as the other folded boxes.
The comic catalogue locale spec and the original language and origin
country specs check filters that phones keep in the Filters sheet. They
now open the sheet first, and again after a reload closes it; wider
screens are unchanged (the helpers do nothing there).
…ster Requests

- Every page is its own chunk behind a skeleton; the open page starts
  downloading with the shell. React and the router get a long-cached
  vendor chunk. The English catalog ships only entries the inline
  defaults can't stand in for (455KB -> 212KB raw)
- lumen-boot.js asks for the session, public settings, the Lumen config
  and the account's settings while the bundle downloads; the app takes
  each answer once
- Figtree is served with the app (variable woff2, preloaded); no Google
  Fonts connections
- Requests: a screen's small pages are asked for together, longer lists
  only when the first page is full; 8 title lookups at once; My requests
  shows its newest page before the whole history; a quick return shows
  the last list while it is checked again; one request count and one
  account-settings read shared across the menu and the page
- Phone tabs only hide for a box someone taps into, not one a page
  focuses itself (Search now arrives after the shell)
lumen-boot.js starts the first API questions while the bundle downloads.
If one of those early requests fails on the network, api() now asks the
same question again instead of failing the page.
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