next: Home's first card loads at once, the page's work after load
MergedThis pull bumps vendor/hud to 1d5b910 and moves the @hud/shared alias in next/. Three things come with the bump:
- Pictures that are first on the screen by their place now load eagerly.
- Stack no longer draws an under-screen that never showed.
- The viewport read-ahead is deferred and throttled.
I read the next/ changes and the changed renderer and shell files in vendor/hud. I did not read the iOS/HUDKit changes or the small shared re-export stubs: they aren't web paths and next/ doesn't build them. The vendor tree isn't hand-edited, so I judged those files as the copy of HUD's change.
I found nothing that must change.
- The
First/setFirstcontext chain holds up.Treeis the root,Listmakes only item 0 first,Panesonly the shown pane, and outside a treefirstOfdefaults to false. shownOnceis filled in an$effect, which doesn't run during server rendering, so the server draws only the top level. Hydration therefore matches, and a level stays drawn once it has shown.- The
@hud/shared/*alias is consistent across tsconfig, vite and the sitemap import.
One minor point. In prefetch.ts a link that intersects while its screen is inert is skipped, and the observer is not re-armed when that screen becomes the top one. Links already in view on a returning screen therefore get no viewport read-ahead until they leave and re-enter the viewport. Hover and press still read ahead, so it only costs a little speed and not correctness.
The home preload only moves once hud-next runs the new HUD, as the body says.
Since my approval at bdef2db, the pull only re-vendors HUD to 5f222fe. The change removes the explicit eager prop from CoverCard, CoverTile and Covers. Picture already decides this from the firstOf() context, and First.svelte and PaneBody.svelte set that context. The first cover therefore still loads eagerly where it is first on the screen, and the props were redundant. I found nothing that breaks the earlier approval. I did not re-check the minor prefetch.ts point from last round. It only costs a little speed and not correctness.
On the prefetch.ts point: fixed in HUD 5addfcf (vendored here). The read-ahead's MutationObserver now watches inert too; when a screen's inert is let go, its links not read ahead yet are unobserved and observed again, so the IntersectionObserver reports those already in view. A link counts as read only once its call is queued, so one whose timer found its screen covered is watched again too. In Chromium (mobile, no hover), scrolling Home and opening a card within 400 ms, then going back, now reads the newly shown neighbours ahead (three calls), where 5f222fe read none.
Since my approval at 7c3c523, the pull re-vendors HUD to 5addfcf. That adds the hero-by-place logic and the 24px targets for ALT, ⓘ and Link names. It also reworks the prefetch (read-ahead) code. I read the changed Picture, hero.ts, Link, AltBadge, InfoBadge, Stack and prefetch.ts files from the pull diff. I did not read the iOS and Android HUDKit changes, the package.json files or the other one-line import swaps. They aren't web paths, and the body says they weren't built.
I found nothing that must change.
- Priority logic:
Picturesetsfetchpriorityto high only for the hero. It sets low for a picture loaded at once beside a hero, and leaves it unset in a tree with no hero. - Earlier
prefetch.tspoint: my earlier concern is now handled. The observer watches theinertattribute and re-observes links once their screen is uncovered, anddonestops links that were already read from being read again. - 24px badges: the badges are bare 24px boxes with the pill drawn inside, and their names now hold "ALT".
One minor point. stop() clears the shared #waiting queue, so it also drops calls queued by another screen's readAhead on the same Ahead. The cost is a little read-ahead speed, not correctness.
Since my approval at f0b6cb0, the only change is hudVersion=0.2.0 in android/gradle.properties. hudkit reads that property to name its version, and the body says the Android check failed to configure without it. The value only labels the module, so it doesn't touch the web changes I approved. I found nothing that must change.
On stop() clearing the shared #waiting: one readAhead runs per Ahead. Shell.svelte attaches it once, to <main> ({@attach reading.readAhead(linked)}), and nothing else calls it. The attachment re-runs only when linked changes, and then the new one starts afresh, so stop() drops only its own queue, which is stale by then. If a second caller ever shares an Ahead, each should keep its own queue. Left as it is.
Since my approval at d3822a1, the only change is a merge of feature/hud into the branch. The merge brought in the already-merged "HUD's own hud check, the app's lexicons and its HUD version" pull. I read the three conflict files named in the merge message: vendor/hud/COMMIT, next/vite.config.ts and android/gradle.properties.
vendor/hud/COMMITstill says 5addfcf, so the HUD vendor bump I approved stands.next/vite.config.tskeeps the@hud/shared/*alias tovendor/hud/web/shared/src, and its comment now names it.android/gradle.propertiesno longer differs from the base, because the base already carrieshudVersion. The pull's duplicate of that change dropped out cleanly.
I did not read the rest of the large merge diff. It is the base's own changes, not the pull's. I found nothing that breaks my earlier approval.
5 passed, 3 skipped
- next: Home's first card loads at once, the page's work after load
- main
What changes
Home's hero is its first photo. HUD's
ui::heropasses over a list that scrolls sideways (strip,shelf), so Home's preloaded, high-priority hero is its first card's first photo, not the first story's 110 KB avatar. That part is HUD's server: it shows once hud-next runs HUD at 5addfcf.Pictures load by place, the hero first. The pictures first on the screen by their place load at once: an Image and a Gallery's first picture, at the tree's top, in a list's first item, in the pane shown. Home's first card, its face and first photo, is drawn so, and its carousel's next photo stays lazy, as do the later cards. Beside a hero they load with
fetchpriority="low", so a gallery's author's 170 KB face no longer shares the bandwidth of its first photo, and on Home the first card's face and first story wait for the photo. A Covers under a gallery waits, but for its hero.Less work while the page loads. A screen under the top one that never showed, such as Home's feed streamed under a gallery opened by its URL, is drawn only once it shows: on a gallery page that was 12 cards rendered and laid out unseen. The viewport read-ahead waits for
loadand idle, makes two calls at a time, and skips inert screens. A screen uncovered again has its links watched afresh, so those in view while it was covered are read ahead after all. Intl formatters and the grapheme segmenter are made on first use.24px targets. The ALT badge's name holds its word ("Show ALT text"), and it and the ⓘ are 24px targets with the same pill drawn inside. A Link drawn as a name or a muted line (a feed card's place) is padded to 24px where its line is shorter, the padding taken back from its margins, so it lays out and looks as before.
vendor/hud is HUD at 5addfcf (app/shell, which holds feature/hud's 84d7175). next/ aliases
@hud/shared/*tovendor/hud/web/shared/src, since HUD's shared code is now the@hud/sharedpackage, and$shared/*is gone. feature/hud (Grain on Android) is merged in.Why
Lighthouse mobile on next.grain.social gave Home 0.48 to 0.82 and the gallery 0.80, accessibility 0.96 on both. Home's LCP element is the first feed photo, which was
loading="lazy"while the first story's avatar held the preload and high priority. The gallery's TBT came mostly from rendering and laying out Home's feed under it. Once the first photo was eager, the gallery's author's face, eager too and as large as the photo, loaded beside it at the same priority: low priority beside a hero keeps it eager (it is on the screen) without competing.How it was checked
Lighthouse mobile (simulated throttling), signed out, on this machine: a release HUD (
HUD_WORKSPACE=off,HUD_APPSa copy of this branch's next/) fronting a production build of next/ (HUD_WEB), each reading the network. Three such stacks side by side: HUD at app/shell's 13b5352 with next/ vendoring it (before), at 5f222fe (this pull's previous head), and at 5addfcf (now). Five runs of each page, interleaved, medians:The gallery is
/profile/aaronstevenwhite.io/gallery/3n2gk44hcsdvf. Its LCP element is its first photo in every run, and Home's is its first card's first photo (a new post took the first card after the first round, for all three alike). On the gallery, before, its author's face started with the photo at high priority. Now it starts with it at low. The LCP regression measured earlier against the live HUD (4.35 to 4.72 s) didn't show here at 5f222fe, and the low priority takes the gallery 0.3 s under it.npm run check,npm run unit(40 pass),npm run ssr,just lint, andjust covat 100% of lines and functions. ssr.mjs checks that the hero is eager, high priority and preloaded as drawn, that a picture first on the screen by its place is eager at low priority beside a hero (with no priority in a tree without one), that Home's first story's face and first card's are those, and that the rest are lazy. In Chromium, a feed card's place is 24px tall where it was 20.3px, every other box in the card where it was. Going back to Home after opening a card whose neighbours had just scrolled into view now reads those neighbours ahead (three calls), where 5f222fe read none.node next/check-apps.mjsandnpm run checkin next/.hud checkat 5addfcf's server code loads next.grain.social's live apps and this branch's next/, withHUD_WORKSPACEoff and on, with no problem.Shortcomings
hudVersionGradle property, which android/gradle.properties gives (0.2.0, HUD's at vendor/hud/COMMIT): without it the android check failed to configure. The iOS app wasn't built here, and Android only by CI's android check.Review
Start at vendor/hud/web/renderer/src/Picture.svelte and hero.ts, then shell/src/Stack.svelte (
shownOnce), prefetch.ts and renderer/src/tree/Link.svelte.